-
-
Save samir-plusb/9b76f5991ab0fca7078b44d5a84fb055 to your computer and use it in GitHub Desktop.
postMessage Example
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
<html> | |
<head> | |
<script> | |
var count=0; | |
function sendMessage() { | |
window.parent.postMessage( | |
JSON.stringify({ | |
url: 'http://heise.de', | |
plus: 21, | |
minus: 42, | |
info: 'das ist meine info'}), // A stringified message to send. | |
"*" // The intended origin, in this example we use the any origin wildcard. | |
); | |
} | |
setInterval(function(){ | |
sendMessage(); // Send a message every second | |
},1000); | |
</script> | |
</head> | |
<body> | |
<p>child window on different domain <a href="">GitHub Gist</a></p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment