Solved! Go to Solution.
IdentityManager is a singleton class and is automatically instantiated into esri.id when the module containing this class is imported into the application. Because IdentityManager extends esri.IdentityManagerBase it inherits all of the IdentityManagerBase class properties and methods.
The Identity Manager API ref documents esri.id: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/identitymanager.htm
The onLegendLoad functiononLegendLoad: function(response, ioArgs) { var minScale=591657527.591555; var maxScale=0; if(!this.tocScales[ioArgs.args.layerName]){ this.tocScales[ioArgs.args.layerName]={response:response, ioArgs:ioArgs}; } dojo.forEach(response.layers, dojo.hitch(this,function(layer){ dojo.forEach(layer.legend, dojo.hitch(this, function(legend){ var legendUrl= legend.url; if(legendUrl.length<10){ legend.url = ioArgs.url.replace("legend?f=json&token=",layer.layerId+"/images/"+legendUrl+".png?token="); legend.url = ioArgs.url.replace("legend?f=json",layer.layerId+"/images/"+legendUrl+".png"); } minScale=layer.minScale; maxScale=layer.maxScale; if(minScale==0){ minScale=591657527.591555; } if((minScale==0&&maxScale<=1)||(this.currentScale>maxScale&&this.currentScale<minScale)){ layer.scaleVisible=true; }else{ layer.scaleVisible=false; } })) })) this.layersInfoLegend.push(response.layers); },
if(document.location.protocol==="https:"){ if(esri.id.credentials.length>0){ params.content["token"]=esri.id.credentials[0].token; } }
Hi there,
I am hoping Jeff or Derek will be able to help me.
I have a secure site running in AGS 10.04 using the JS API 2.8.
I am having trouble getting the legend widget to display the icons for the layers in IE. All works fine in Chrome, FF and Safari but in IE I get the red cross error.
All worked fine before I switched to https. I've read several posts which suggest its something to do with the token service not authenticating the legend, but I am stuck as to how to correct this.
The code quoted below seems like it should be what I need but I'm unsure how to hook this in.
Is there something I can force in my proxy.jsp page? Or hardcode in my .js page?
Any help or suggestions would be most welcome.
Many thanks,
Ben Sayers
Are you manually building a legend?
if so then you can add the token to the params prior to making the legend requestif(document.location.protocol==="https:"){ if(esri.id.credentials.length>0){ params.content["token"]=esri.id.credentials[0].token; } }
var legend = new esri.dijit.Legend({ map: map, layerInfos: legendLayers }, "legendDiv"); legend.startup(); });