Skip to content

Instantly share code, notes, and snippets.

@qubird
Created November 13, 2013 15:26
Show Gist options
  • Save qubird/7450883 to your computer and use it in GitHub Desktop.
Save qubird/7450883 to your computer and use it in GitHub Desktop.
// In the parent frame
window.addEventListener("message", function(evt) {
var data;
console.debug("Got message: ", evt);
data = JSON.parse(evt.data);
// Do something...
}, false);
// In the child frame
window.parent.postMessage(JSON.stringify({action: "doSomething", args: {foo: "1}}), "*");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment