XMLHttpRequest cannot load http://sampleserver1.arcgisonline.com/ArcGIS/rest/info?f=json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

I'm getting this error. What might be the problem? I'm beginner to ARCGIS JSAPI,


Like @ahammadalipk points out it's a CORS issue and not specific to the JSAPI.

I don't think sampleserver1 supports CORS (it's an old server). Another alternative is to use a proxy. See https://developers.arcgis.com/javascript/jshelp/ags_proxy.html

Or maybe take a step back. Depending on what you are trying to do, you might want to test with a newer server, either on ArcGIS Online or sampleserver6.arcgisonline.com. Both of those supports CORS. There's an example for the latter: https://developers.arcgis.com/javascript/jssamples/util_relation.html


you can try this:

  • Thanks @emredelioglu, I tried with that but still I'm getting the same error. – Naveen Kairamkonda Apr 3 '16 at 8:42

This is the CORS issue, you need to enable JavaScript in sample server,basically server will block JavaScript request unless you give JavaScript permission.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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