blob: 912443908af88ad7ea2f366117b75206f064519b [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script>
function fetchError() {
top.postMessage("fetchError", "http://127.0.0.1:8000");
}
function fetchSuccess() {
top.postMessage("fetchSuccess", "http://127.0.0.1:8000");
}
fetch("http://localhost:8000/from-origin/resources/fetch.php?fromOrigin=same").then(function(response) {
return response.json();
}).then(function(data) {
const parsedData = JSON.parse(data);
if (parsedData.Fetch)
fetchSuccess();
else
fetchError();
}).catch(function(error) {
fetchError();
});
</script>
</head>
<body>
<h3>The iframe making a localhost fetch call.</h3>
</body>
</html>