Access denied in IE 10 and 11 when ajax target is localhost

Internet Explorer raises this error as part of its security zones feature. Using default security settings, an “Access is Denied” error is raised when attempting to access a resource in the “Local intranet” zone from an origin in the “Internet” zone.

If you were writing your Ajax code manually, Internet Explorer would raise an error when you try to open the resource. For example:

var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://localhost/', true); // This line will trigger an error
xhr.send();

You can work around this error by adding the origin site to the “Trusted sites” security zone. You can test this by adding “http://client.cors-api.appspot.com” to your “Trusted sites” zone and using this test page at test-cors.org with your localhost site as the Remote URL.

Leave a Comment