Created
February 29, 2012 18:58
-
-
Save daniel-nelson/1943546 to your computer and use it in GitHub Desktop.
Cross-domain iframe communication for modern browsers + IE8
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
if (typeof(window.postMessage) == 'function') { | |
window.frames['frame_name'].postMessage(message, '*'); | |
} else if (typeof(window.postMessage) == 'object') { | |
window.setTimeout(function() { | |
window.frames['frame_name'].postMessage(message, '*') | |
}, 0); | |
} | |
if (typeof window.postMessage == 'function') { | |
window.removeEventListener('message', receiveMessage, false); | |
} else if (typeof window.postMessage == 'object') { | |
window.detachEvent('onmessage', receiveMessage); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment