AnsweredAssumed Answered

How to catch CORS Error on picture Symbol

Question asked by staplern on Jul 17, 2019
Latest reply on Jul 19, 2019 by NSager-esristaff

I am creating graphics and adding them to a graphics layer- this is a simplified version of what i'm doing.

symbol = {
          type: "picture-marker",
          url: item.attributes.iconUrl,
          width: sizeL[0] + "px",
          height: sizeL[1] + "px"

var gO = {
                    geometry: item.geometry,
                    attributes: item.attributes,
                    symbol: symbol

var g = new Graphic(gO);

layer = new GraphicsLayer(); = [gO];


No error occur until after the layer is added to the map and i get cors error for the picture url:


Access to image at 'xxx.png' from origin 'http://localhost:xxxx has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Then the markers are still rendered, they just are black dots:

How can i intercept the error so that I can either suppress it in the console or delete the graphics layer and reconstruct it with a working image?