Created
May 25, 2016 15:59
-
-
Save cesarpachon/f187e6114d0acf2978360bdf1f7e0db2 to your computer and use it in GitHub Desktop.
communicate iframe with parent via postMessage
This file contains hidden or 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
//in the parent: | |
window.addEventListener("message", function(m){console.log(m);}) | |
//in the iframe: | |
window.parent.postMessage("hola", "*") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment