开发者

Why is this failing in IE?

开发者 https://www.devze.com 2023-02-07 12:40 出处:网络
My website fails in IE.I only have access to Macs so it\'s hard to test and parallels is meh.I have been able to check once or twice so I know it fails when it searches youtube.

My website fails in IE. I only have access to Macs so it's hard to test and parallels is meh. I have been able to check once or twice so I know it fails when it searches youtube.

Close the popup > Hit 2010 > Hit 10/20 > Hit My Soul > Error

http://www.phishvid.开发者_StackOverflowcom/

Could anyone provide some insight? Here's the code where it fails:

Thanks!


You are trying to make an AJAX request to a different domain, which is being restricted by the Same Origin Policy.

To over come this use JSONP, to make your request use JSONP callback=? to the url that your requesting, this will help you overcome the cross-domain barrier.

You updated url should look like

 $.getJSON("http://gdata.youtube.com/feeds/api/videos?callback=?&max-results=5&alt=json&q=phish " + song + " " + month2 + " " + day + " " + year, function (data) {
   //your callback code
 }

Example


My IE reports "Access is denied" in jquery-1.4.4.min.js on line 138, char 355 which on your site looks like this:

if(w){b.username?w.open(h,b.url,b.async,b.username,b.password):w.open(h,b.url,b.async);try{if(b.data!=null&&!l||a&&a.contentType)w.setRequestHeader("Content-Type",
b.contentType);if(b.ifModified){c.lastModified[b.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[b.url]);c.etag[b.url]&&w.setRequestHeader("If-None-Match",c.etag[b.url])}o||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(I){}if(b.beforeSend&&b.beforeSend.call(b.context,w,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");w.abort();return false}b.global&&
c.triggerGlobal(b,"ajaxSend",[w,b]);var L=w.onreadystatechange=function(m){if(!w||w.readyState===0||m==="abort"){J||c.handleComplete(b,w,e,f);J=true;if(w)w.onreadystatechange=c.noop}else if(!J&&w&&(w.readyState===4||m==="timeout")){J=true;w.onreadystatechange=c.noop;e=m==="timeout"?"timeout":!c.httpSuccess(w)?"error":b.ifModified&&c.httpNotModified(w,b.url)?"notmodified":"success";var p;if(e==="success")try{f=c.httpData(w,b.dataType,b)}catch(q){e="parsererror";p=q}if(e==="success"||e==="notmodified")d||
c.handleSuccess(b,w,e,f);else c.handleError(b,w,e,p);d||c.handleComplete(b,w,e,f);m==="timeout"&&w.abort();if(b.async)w=null}};try{var g=w.abort;w.abort=function(){w&&Function.prototype.call.call(g,w);L("abort")}}catch(i){}b.async&&b.timeout>0&&setTimeout(function(){w&&!J&&L("timeout")},b.timeout);try{w.send(l||b.data==null?null:b.data)}catch(n){c.handleError(b,w,null,n);c.handleComplete(b,w,e,f)}b.async||L();return w}

the actual character number 355 is the first b, so I'm guessing you might have come across a bug in jQuery 1.4.4? you could try to either use a previous version (unless you are using some 1.4.4 specific features) or replace the .min.js file with the full jquery file, insert a debugger-statement into the jquery-file at this location (before it throws the exception) and try to debug to figure out what is wrong. You can for instance use Microsoft Visual Web developer to debug, or if the same issue occurs in IE9 it has a built in .js - debugger as well

EDIT: after seeing the full jQuery code you posted it is clear that the problem is that jQuery in this case is trying a standard ajax call, not JSONP. (standard ajax only allowed back to the server which served the javascript)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号