Created
June 25, 2018 11:06
-
-
Save NiklasHansen/e9fe3470187e8ce30224b03bcb14fdc0 to your computer and use it in GitHub Desktop.
Internet Explorer issue, regarding opener.postMessage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Child page</title> | |
<meta charset="utf-8" /> | |
</head> | |
<body> | |
Return value: <input type="text" id="returnValue"> | |
<p>Click the button to close the browser window.</p> | |
<button onclick="myFunction()">Try it</button> | |
<script> | |
function myFunction() { | |
var returnValue = document.getElementById("returnValue").value; | |
opener.postMessage({ 'returnValue': returnValue }, "*"); | |
window.close(); | |
} | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Main page</title> | |
<meta charset="utf-8" /> | |
</head> | |
<body> | |
<p>Click the button to open a new browser window.</p> | |
<p>Returned: <span id="returnValue"></span></p> | |
<button onclick="myFunction()">Try it</button> | |
<script> | |
function myCallback(ejendomsnummer) { | |
document.getElementById("myParagraf").innerHTML = ejendomsnummer; | |
} | |
function myFunction() { | |
var myWindow = window.open("ChildPage.html", "Ejendomsidentifikation"); | |
} | |
window.addEventListener("message", function (e) { | |
var event = e; | |
document.getElementById("returnValue").innerHTML = event.data.returnValue; | |
}, false); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment