Preventing "SCRIPT5: Access is denied" error in IE Preventing "SCRIPT5: Access is denied" error in IE ajax ajax

Preventing "SCRIPT5: Access is denied" error in IE


I found a workaround. This appears to be a bug ("feature"?) in jQuery 1.10.1. Using jQuery 1.10.0, the error no longer occurs:

http://jsfiddle.net/86q5k/5/

<iframe src="http://endorkins.com/test-iframe-1.10.0.html"></iframe>

Strange. Very strange. If anyone knows the reason why this is happening in 1.10.1, and how to fix it, I (and jQuery minions around the globe) would certainly be very interested to know! :)


UPDATE: Looks like this is a legit jQuery 1.10.1 bug: http://bugs.jquery.com/ticket/13980


UPDATE: According to @emanuele-greco, this is fixed in 1.10.2 and up. So, upgrading your version of jQuery will likely fix the problem.


Ok I Found the same problem and fixed it with the weirdest and most horrible solution ever.

I'm trying to use an image to popup the file upload dialog, then do an automatic form submit on the change event. I had resigned my self that in IE the users were going to have to click an image to do the post. I placed the image on the form (like i have in several places on the site. This to generated the access denied error, In shock I clicked it again and Yep got the error. On the third click it worked. So I tried it again with the same results first two clicks error and the third worked. And teh simple Javascript code that is ugly as home made soap but now works is

var files= document.getElementById("newfiles");files.onchange = addFiles;function addFiles() {    try {        $("#fileupload").submit();    } catch (e) {        try {            $("#fileupload").submit();        } catch (e) {            try {                $("#fileupload").submit();            } catch (e) {                alert(e);            }        }    }};


Make sure also that you are not loading your jQuery asset from a CDN such as Google Hosted Libraries. Because the domain is different, that violates certain security protocols that Microsoft uses to protect against Cross Site Scripting in Internet Explorer.