Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am getting these errors when someone attempts to open my app in IE. I get a popup asking to Allow Blocked Content, and when this is clicked everything works fine. Is there anyway I can go about enabling CORS to bypass clicking Allow Blocked Content?

SEC7118: XMLHttpRequest for http://services.arcgisonline.com/ArcGIS/rest/info?f=json required Cross Origin Resource Sharing (CORS). 
EDDM_API.html

SEC7120: Origin file: not found in Access-Control-Allow-Origin header. 
EDDM_API.html

SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.
EDDM_API.html

SEC7118: XMLHttpRequest for http://static.arcgis.com/attribution/World_Street_Map?f=json required Cross Origin Resource Sharing (CORS). 
EDDM_API.html

Searching the web I found this bit of code, just unaware of where to put it in my script, or if it will even solve my problem.

// Script running on http://eddmapi-dev.usps.gov/eddmapi/eddm_api.html
var xhr = new XMLHttpRequest();
    xhr.onerror = _handleError;
    xhr.onload = _handleLoad;
    xhr.open("GET", "http://eddmapi-dev.usps.gov/eddmapi/eddm_api.html", true);
    xhr.send();
share|improve this question
    
Can you tell us why you think this is a GIS question? –  BradHards Jun 29 '13 at 11:22
    
Trying to troubleshoot a webapp I made with the ArcGIS JavaScript API. –  Maksim Jul 1 '13 at 12:11
    
I don't think the problem is anything to do with that particular API (and is hence off-topic), but I'm not worried enough to do anything about it. Perhaps you might like to look at gis.stackexchange.com/questions/57546/… and check this isn't the same issue. –  BradHards Jul 2 '13 at 8:09
    
Does your web server use IIS or Apache? –  raykendo Aug 7 '13 at 17:38
    
@BradHards assuming that CLJ's answer is correct, that would give a reason why this is GIS-specific, ie it depends on a feature of the ArcGIS JS API –  Stephen Lead Sep 7 '13 at 22:06

3 Answers 3

I suspect that the Blocked content is not related to using the esri services. Try creating a simple site that just creates a map with basemap and set esriConfig.defaults.io.corsDetection = false and then explicitly adding any coors enabled servers into esri.config.defaults.io.corsEnabledServers as suggested by CLJ. This will get rid of the error XMLHttpRequest and should hopefully reveal that the issue is related to another aspect of your site

share|improve this answer

You will need to specify your enabled servers:

esri.config.defaults.io.corsEnabledServers.push("serverapi.arcgisonline.com");
esri.config.defaults.io.corsEnabledServers.push("services.arcgisonline.com");
esri.config.defaults.io.corsEnabledServers.push("static.arcgis.com");
share|improve this answer

You'll need to configure the webserver to enable Cross Origin Resource Sharing (CORS). Depending on whether you use IIS, Apache, or one of the other ones out there, reconfiguring the app isn't too difficult. Here's a link to how to enable CORS for your application: http://enable-cors.org/server.html

share|improve this answer
    
He can't enable coors services.arcgisonline.com as this isn't his server it's ESRI's server. There has been an 'ideas' open for this for a long time, please upvote it ideas.arcgis.com/ideaView?id=08730000000bvtBAAQ –  David Wilton Nov 13 '13 at 10:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.