0

I'm trying to use a javascript locator object with a geocode server of ArcGIS Online: http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Locators/ESRI_Geocode_EU/GeocodeServer

When I call the method locator.addressToLocations(options), I get the cross-origin problem.

Is there a way to avoid this?

  • which browsers did you test on? – Aamir Suleman Jan 9 '15 at 19:59
  • Mozilla FF 34.0 and Google Chrome 39.0 – yo_haha Jan 12 '15 at 8:23
1

as mentioned in the header for this sample, when the server you are making calls to actually supports CORS, you can notify the JSAPI like this.

esriConfig.defaults.io.corsEnabledServers.push("server.com")

that being said, i don't think sampleserver1.arcgisonline.com supports CORS, so i'd recommend using our production World Geocoding Service instead.

in situations where you must work with a server that doesn't support CORS, or need to support browsers that don't support CORS, you'll have to configure a proxy and reference it in your application.

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.