Access-Control-Allow-Origin Errors. Has There Been Changes?

1936
6
08-21-2012 06:55 PM
JithenSingh
Esri Contributor
Hi There,

Have there been changes to Access-Control-Allow-Origin on serverapi.arcgisonline.com and arcgis.com and services.arcgisonline.com?
I've noticed that in the last week I've been starting to see these error's crop up.

Anyone else noticing this and are there problems or is this permanent now?

Thanks
0 Kudos
6 Replies
JohnGravois
Frequent Contributor
starting at version 3.x of the Javascript API, we check for CORS support and use it when available.  If you are working with ArcGIS Server machines that don't support CORS, you can safely ignore the messages which appear in the console.

see the following link for more information
http://help.arcgis.com/en/webapi/javascript/arcgis/help/jshelp/new_v30.html
0 Kudos
derekswingley1
Frequent Contributor
John's correct�?? the "errors" you see are related to figuring out whether or not a server supports CORS and this was new with version 3.0 of the JS API.

These errors will go away when the servers you mentioned are upgraded to AGS 10.1. IIRC, that's happening this fall. Until then, these errors can be safely ignored.
0 Kudos
JithenSingh
Esri Contributor
Thanks. I notice now though that one cannot simple copy the code for samples, add it to a html file and run it as Access-Control-Allow-Origin does not allow it. At times I am finding that LOCALHOST is being blocked as well. See image below:

[ATTACH=CONFIG]17161[/ATTACH]

While I don't mind ignoring some of the errors, it's a bit hard when the map doesn't even load at all and neither does any of the JS/CSS.

Makes creating simple mashups for dev purposes really hard.
Any ideas?
0 Kudos
JohnGravois
Frequent Contributor
errors regarding CORS support shouldn't have any impact on the functionality of your web application.  you should be able to copy and paste our samples and run them locally via HTTP (as long as a web server like IIS or Apache is installed) and "mash them up" for development purposes.

what particular sample are you working with?  is the problem only occurring when you load the HTML as a file rather than using HTTP?
0 Kudos
JithenSingh
Esri Contributor
Ok the problem seems to only occur when loading the HTML as a file. This used to work previously which made testing things easy.

Using HTTP seems to work in loading this map. I was  just testing so I took the first sample from the js samples, copied it into a temp.html file and tried it.

So it has to be HTTP. I take it, there is no way to load the HTML as a file any more?

Cheers
0 Kudos
JohnGravois
Frequent Contributor
i'm glad to hear you've isolated the cause of the error.  please use HTTP as it is definitely the best practice for developing applications (big and small :)).
0 Kudos