Help! Unable to add webmap

12-17-2019 03:22 PM
New Contributor

Trying to add a webmap but even in the sandbox I get 

Fetch API cannot load due to access control checks.

Origin xxx is not allowed by Access-Control-Allow-Origin

var webmap = new WebMap({
portalItem: {
id: "ec16ffd3c25b4e3d8af9c1bf9a14af08"

Any suggestions?

Tags (2)
0 Kudos
1 Reply
Esri Regular Contributor

It looks like the 4x API is a bit more strict with cors and ssl than the 3x version (which is why I think it displays in the 3x based AGO Map Viewer). If you add a proxy to the mix, the wmts webmap displays fine.


CORS with the API | ArcGIS API for JavaScript 4.14 

GitHub - Esri/resource-proxy: Proxy files for DotNet, Java and PHP.  (codepen does not run, but if you supply a link to your proxy and run locally, it will work)

0 Kudos