Created
April 22, 2013 18:59
-
-
Save davidpelaez/5437556 to your computer and use it in GitHub Desktop.
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
| receiveMessage = (event)-> | |
| # Do we trust the sender of this message? (might be | |
| # different from what we originally opened, for example). | |
| #return if (event.origin !== "http://example.org") | |
| # event.source is popup | |
| # event.data is "hi there yourself! the secret response is: rheeeeet!" | |
| console.log "iframe:", event.data | |
| window.addEventListener "message", receiveMessage, false | |
| window.onload = -> | |
| console.log "[potential] IFRAME LOADED!" | |
| w = window | |
| #while ((w = w.parent) && (window.top !== w)) | |
| if parent is window | |
| console.log "THIS IS NOT in IFRAME" | |
| else | |
| parent.postMessage('vlipco:checkout:ready','*') | |
| console.log "I'm an IFRAME!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment