Created
March 3, 2013 22:13
-
-
Save donjaime/5078567 to your computer and use it in GitHub Desktop.
PostMessage into a dynamically created iframe.
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
| var frame = document.createElement("iframe"); | |
| frame.src="https://<the mothership's domain>/inner.html"; | |
| frame.onload = function() { | |
| // If this is a Chrome content script, contentWindow is offlimits. | |
| frame.contentWindow.postMessage("A Message!", "https://<the mothership's domain>"); | |
| } | |
| document.body.appendChild(frame); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment