Select to view content in your preferred language

Default legend widget does not work over https in IE

10007
36
05-17-2012 05:38 AM
BenSayers
Emerging Contributor
When using the default ESRI widget the legend symbology do not show up when using Internet Explorer (IE). They show fine in Chrome, Safari and Firefox, but when using IE this all that is displayed is the browser standard red x's.

I have seen others having the same trouble in various different posts and some people have suggested various fixes for previous versions of the API, but none work for me. I am using AGS 10.04 and JS API v2.8.

Has anyone fixed this exact problem? Anyone at ESRI looked in to this?

Any help/suggestions will be greatly appreciated.

In anticipation, Ben.
0 Kudos
36 Replies
derekswingley1
Deactivated User

https://www.mymanatee.org/arcgis/rest/services/utilities-infrastructure/irrigation/MapServer/?token=....

not sure how long that token is good for.


That circumvents the purpose of using the Identity Manager. Is that what you're doing in your app?
0 Kudos
JeffPace
MVP Alum
That circumvents the purpose of using the Identity Manager. Is that what you're doing in your app?


Yes and no.  WE use the identity manager, but there are two cases where we cannot.  First is a custom TOC that i make direct calls to the legend thumbnail for each layer.  Second is for a custom print servlet that i have to pass each individual tile/dynamic image path to.

For each of these I extract the token and append it so i can make an independent in a different session.


However this is not related to the error.  I extracted that URL from firebug just to give you a path to work with.  The error we are seeing is in the default legend widget using the identity manager.
0 Kudos
derekswingley1
Deactivated User
The error we are seeing is in the default legend widget using the identity manager.


Thanks for clarifying. I'm still waiting to hear back about testing this with a JSP proxy on a AGS Java instance + SSL.
0 Kudos
JeffPace
MVP Alum
Thanks for clarifying. I'm still waiting to hear back about testing this with a JSP proxy on a AGS Java instance + SSL.


Ok here goes an example

https://www.mymanatee.org/gisapps/mapviewer-test/index.jsp?type=utilitiesinfrastructure&extent=-9200...

In firefox:
1. Log in u: esri p: esri
2. After logging in, refresh the layer visibility in the Live Map widget (working on automating that) using the green refresh arrows
3. Turn on the Irrigation layer (this is the secure layer)
4. Open the Legend from the widget menu.  Notice the icons for the non-label layers

In IE:
1. Click ok on warning about insecure content
2. Log in u: esri p: esri
3. If the Live Map widget does not open, open it by using the Folder Icon or from the Map Menu (IE doesnt like automation)
4. Refresh the layer visibility in the Live Map widget (working on automating that) using the green refresh arrows
5. Turn on the Irrigation layer (this is the secure layer)
6. Open the Legend from the widget menu.  Notice the red "Xs" instead of icons for all layers

hope this helps.
0 Kudos
derekswingley1
Deactivated User
I'm looking at your repro case, and you're loading a few non-SSL resources (all the Google CDN hosted stuff). I don't think this affects why the images aren't displaying, but it's one thing that contributes to IE showing a security warning.

Anyway, I've confirmed that the requests for the images for your legend don't have a token appended to them. There is a token appended in the example I posted. Can you open a ticket with support and have them look into this further?
0 Kudos
BabbageOcelot
Deactivated User
Sorry to resurrect the thread, but I've encountered this also.

Did you find a resolution to this? I'll probably put a support call in too, but it'd be handy to have the solution in the public domain once it's found - there are quite a few threads on the subject.

The observed behaviour differs according to whether you're using the ArcGISDynamicMapServiceLayer or the FeatureLayer class. Basically, the former fails with the above described error, and the latter works, as in the above example. Both are fine in Firefox, just not IE.

The code below illustrates this, pop it into the above example supplied by Derek:
dojo.require("dijit.layout.BorderContainer");
      dojo.require("dijit.layout.ContentPane");
      dojo.require("dijit.layout.AccordionContainer");
      dojo.require("esri.map");
      dojo.require("esri.dijit.Legend");
      dojo.require("esri.arcgis.utils");
      dojo.require("dijit.form.CheckBox");
      dojo.require("esri.IdentityManager");

      var map;
      var legendLayers = [];

      function init() {
        esri.config.defaults.io.proxyUrl = "proxy/proxy.ashx";

        map = new esri.Map("map", {
          extent: new esri.geometry.Extent({"xmin":-12034010,"ymin":4487877,"xmax":-11965751,"ymax":4525561,"spatialReference":{"wkid":3857}})
        });

        //Add the terrain service to the map. View the ArcGIS Online site for services http://arcgisonline/home/search.html?t=content&f=typekeywords:service
        var basemap = new esri.layers.ArcGISTiledMapServiceLayer("https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer");
        map.addLayer(basemap);

        var trailsService = new esri.layers.ArcGISDynamicMapServiceLayer("https://servicesbeta.esri.com/ArcGIS/rest/services/SanJuan/Trails/MapServer", {
          id: "Trails"
        });
        
  /**
  // This will work.
  var conditions = new esri.layers.FeatureLayer("https://servicesbeta.esri.com/ArcGIS/rest/services/SanJuan/TrailConditions/FeatureServer/0",{
          id: "Conditions",
          mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
          outFields: ["*"]
        });
  **/
  
  // This will fail.
  var layerURL = "https://servicesbeta.esri.com/ArcGIS/rest/services/SanJuan/TrailConditions/MapServer";
  var conditions = new esri.layers.ArcGISDynamicMapServiceLayer(layerURL);
  
        legendLayers.push({ layer: trailsService, title: 'Trails' });
        legendLayers.push({ layer: conditions, title: 'Conditions' });

        dojo.connect(map,'onLayersAddResult',function(results){
          console.log("layers add result: ", results, legendLayers);
          var legend = new esri.dijit.Legend({
            map: map,
            layerInfos: legendLayers
          },"legendDiv");
          legend.startup();
        });
        map.addLayers([trailsService, conditions]);

        dojo.connect(map, 'onLayersAddResult', function(results) {
          //add check boxes
          dojo.forEach(legendLayers, function(layer){
          var layerName = layer.title;
          var checkBox = new dijit.form.CheckBox({
            name: "checkBox" + layer.layer.id,
            value: layer.layer.id,
            checked: layer.layer.visible,
            onChange: function(evt) {
              var clayer = map.getLayer(this.value);
              clayer.setVisibility(!clayer.visible);
              this.checked = clayer.visible;
            }
          });

          //add the check box and label to the toc
          dojo.place(checkBox.domNode,dojo.byId("toggle"),"after");
          var checkLabel = dojo.create('label',{'for':checkBox.name, innerHTML:layerName},checkBox.domNode,"after");
          dojo.place("<br />",checkLabel,"after");
        });
      });

      dojo.connect(map, 'onLoad', function(theMap) {
        //resize the map when the browser resizes
        dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
      });
    }

    dojo.addOnLoad(init);


Just for the record, it displays the same symptoms using api 2.6 and non-https services.

Cheers, Ben.
0 Kudos
BenSayers
Emerging Contributor
Hi Ben,
I've never heard back from ESRI UK about the problem, so I am back to using a static legend. If you ever get the answer please post.
Many thanks,
Ben
0 Kudos
JohnGravois
Deactivated User
I was able to confirm Ben's findings that the error seems to be isolated to DynamicMapService layer swatches. 

The following defect has been logged for the request.  [#NIM081725  Legend swatches for secure Dynamic Map Service layers are not returned in Internet Explorer only when application uses Identity Manager and is hosted on HTTPS. ]

Please don't hesitate to contact Esri technical support to add your name to the list of customers requesting that the issue be resolved.
0 Kudos
suhanatssuhanats
Emerging Contributor
I was able to confirm Ben's findings that the error seems to be isolated to DynamicMapService layer swatches. 

The following defect has been logged for the request.  [#NIM081725  Legend swatches for secure Dynamic Map Service layers are not returned in Internet Explorer only when application uses Identity Manager and is hosted on HTTPS. ]

Please don't hesitate to contact Esri technical support to add your name to the list of customers requesting that the issue be resolved.


Hi,
has there been any progress on this issue.
I am having similar problem where legend symbols show as red cross in internet explorer 8. it shows find in chrome.
I am using javascript api 2.8 and arcgisserver sp4. I am not using IdentifyManager. Yes I am using arcgisserver token security where I use proxy.ashx and proxy.config file as recommended by esri as I need to provide a standard username and password and not have the users type in their credentials again and again.
Thanks!
0 Kudos
DavideLimosani
Frequent Contributor
hi all,

I have found this workaround in the meantime, I hope it works for you too.

add it to the event onZoomEnd of your map.

function onZoomEnd()
{
    if (navigator.appName == 'Microsoft Internet Explorer')
    {
        timer = setTimeout(function () {
        var imgs = dojo.query('.esriLegendLayer > tbody > tr > td > img');
        for(var i=0; i<imgs.length; i++){
            imgs.src = "yourproxy" + imgs.src;
        }
        }, 100);
    }
}
0 Kudos