8

Every development pipeline has 2 parts. FIRST to work hard and develop the application. SECOND to work harder and make it compatible with the great arrogant IE.

We have an AngularJS (v1.3.13) application without any server side code developed in Webstorm. We are making REST calls to service. Our application works fine on Chrome and Firefox without any Console errors. However when we try to open the page in IE11 or IE9 (not tried IE10), our page doesn't load. Console suggests we have 2 errors. One of them is Access is Denied on

xhr.open(method, url, true);

in angular.js.

There are number of posts on internet and none seems to be working. This is what I have tried.

  1. Hosting app in IIS with changed Handler Mappings to support Cross Domain calls on an Application pool of .Net v4.0 (as suggested by a Senior)
  2. Tried to disable to cache for HTTP requests.
  3. Adding Domain in trusted site category and also adding locahost/IP to local intranet.
  4. Changing request type to JSONP and trying to add Access-Control-Allow-Origin (with value of *) to headers.
  5. Changing IE settings to allow Cross Domain calls.

Error is still chasing us. Even my colleagues have tried the same on their machines ending up with similar blow. Is there anyone to suggest me something on this.

It may be CORS and I may need to go for xdr (XDomainRequest) but not sure how to use it as error is in angular.js. I am certainly no expert on this so please suggest.

Screen shot of the error: enter image description here

IE shows another error: [$injector:nomod] Module 'ngLocale' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. http://errors.angularjs.org/1.2.16/$injector/nomod?p0=ngLocale which I am ignoring for now.

Please suggest me something on this. Thanks.

Sandy
  • 11,332
  • 27
  • 76
  • 122
  • Do you have any plunker or fiddle for this? – Vinay K Feb 26 '15 at 11:16
  • No...Not sure how to come up with one as its project code. – Sandy Feb 26 '15 at 11:19
  • _We have an AngularJS (v1.3.13) application_ - The error message says something different. The cause of the problem is that angular.js is not hosted on the same domain as the application. IE9 doesn't support CORS via `XMLHttpRequest`. It should work with IE10+. If it doesn't work in IE11 then maybe the browser runs in some compatibility mode. – a better oliver Feb 26 '15 at 12:56
  • Given that you're running .NET and likely loading content in zone other than Internet, it's quite likely older IE is running in earlier compat mode. Also, @zeroflagL is correct, IE9 does not support CORS; however, there are hacks mentioned in the wild. Consider https://samuellam.wordpress.com/2013/08/03/ie-89-cors-support-in-angular-js/ for example, which looks like a useful approach. – Lance Leonard Feb 26 '15 at 15:12
  • @LanceLeonard We are running IE11, so your post may not help. However things mentioned may not fit in the project we are making. – Sandy Feb 27 '15 at 03:25
  • @Sandy, IE11 supports XHR and CORS. If you're not seeing that, then you're most likely not rendering in edge mode. You've not provided any information about your markup, but if .NET is involved, it's a strong possibility. – Lance Leonard Feb 27 '15 at 04:03
  • @LanceLeonard...Thats correct and IE supports XHR/CORS. But any how its not working. In developers tool I could see the mode as Edge. Please suggest what other info you need and I will do my best to provide :) – Sandy Feb 27 '15 at 14:24
  • http://stackoverflow.com/questions/27463901/setting-window-location-or-window-open-in-angularjs-gives-access-is-denied-in – JungTae Mar 23 '17 at 07:02

4 Answers4

1

I switched from 1.3.4 to 1.4.8 and that did the trick. No more Angular Access Denied in I.E. (Microsoft Edge 25 2015). I don't know why.

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.8/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-route.js/1.4.8/angular.min.js"></script>
1

Access is Denied on IE11 in AngularJS error have a solution on this link I also got the same error while downloading Image from IE11. I have just added the following line in my code and It works.

window.navigator.msSaveBlob(blob, paramDataObject.fileName); 
or
window.navigator.msSaveOrOpenBlob(blob, paramDataObject.fileName);
Surendranath Sonawane
  • 1,595
  • 1
  • 18
  • 24
0

Have you tried xdomain? https://github.com/jpillora/xdomain it's a pure javascript CORS alternative.

webdev5
  • 467
  • 1
  • 8
  • 22
0
if (window.navigator && window.navigator.msSaveOrOpenBlob) {   
   window.navigator.msSaveOrOpenBlob(blob);
}
else {   
   var objectUrl = URL.createObjectURL(blob);    
   window.open(objectUrl);
}

Setting window.location or window.open in AngularJS gives "access is denied" in IE 11

Community
  • 1
  • 1
JungTae
  • 1
  • 1