I have an iframe using the jQuery 1.4.2 script. The same iframe is injected into both http
and https
sites. The jQuery script is included in the main HTML file as a relative path (e.g., /scripts/jquery-1.4.2.min.js).
When an AJAX call is made, Internet Explorer denies access. The AJAX is calling on another subdomain, but it's using the right protocol. All other browsers work but Internet Explorer gives the following error:
SCRIPT5: Access is denied.
jquery-1.4.2.min.js, line 127 character 344
I heard this error is from cross-domain AJAX calls. But why is IE the only one giving me crap? Is there an IE solution?
Also, this is my AJAX:
$.ajax({ url: thisURL, dataType: "json", data: {cmd : 'getMessage', uurl: urlVar, t: Math.random()}, success: function(ret){ callback(ret) } });
IE requires you to use XDomainRequest instead of XHR for cross site, you can try something like...
if ($.browser.msie && window.XDomainRequest) { // Use Microsoft XDR var xdr = new XDomainRequest(); xdr.open("get", url); xdr.onload = function() { // XDomainRequest doesn't provide responseXml, so if you need it: var dom = new ActiveXObject("Microsoft.XMLDOM"); dom.async = false; dom.loadXML(xdr.responseText); }; xdr.send(); } else { // your ajax request here $$.ajax({ url: thisURL, dataType: "json", data: {cmd : 'getMessage', uurl: urlVar, t: Math.random()}, success: function(ret){ callback(ret) } }); }
Reference
http://forum.jquery.com/topic/cross-domain-ajax-and-ie
not sure whether it fits your scenario
xdr = new XDomainRequest(); xdr.onload=function() { alert(xdr.responseText); } xdr.open("GET", thisUrl); //thisURl ->your cross domain request URL //pass your data here xdr.send([data]);
you can find some more guidance here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With