Created
March 24, 2011 17:56
-
-
Save getify/885526 to your computer and use it in GitHub Desktop.
This file contains 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
function xdomainajax() { | |
var win; | |
if (document.location == "otcsandbox.com") { | |
var content = "<html><body><scr"+"ipt>document.domain='otcsandbox.com';</scr"+"ipt><scr"+"ipt src='http://wheretogetjqueryfrom.com/jquery.js'></scr"+"ipt></body></html>"; | |
var iframe = document.createElement("iframe"); | |
document.body.appendChild(iframe); | |
win = iframe.contentDocument ? iframe : iframe.contentWindow ? iframe.contentWindow : iframe; | |
var doc = iframe.contentDocument ? iframe.contentDocument ? iframe.contentWindow ? iframe.contentWindow.document ? win.document; | |
doc.open(); | |
doc.writeln(content); | |
doc.close(); | |
} | |
else { | |
win = window; | |
} | |
win.jQuery.ajax(....); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment