Solved! Go to Solution.
Are you running the code posted previously at the top of your function that dojo.ready calls?
Let me 'splain.
[pause]
No, there is too much. Let me sum up.
function initSecurity() { // Comment out these lines, and the onresize on body // if you don't want full-screen var serverInfo = new esri.ServerInfo(); serverInfo.server = 'https://www.mymanatee.org'; serverInfo.tokenServiceUrl = 'https://www.mymanatee.org/arcgis/tokens/generateToken'; esri.id.registerServers([serverInfo]); }; if(document.location.protocol==="https:"){ dojo.addOnLoad(initSecurity); }
var params = { url:urls+"/legend", layerName:layerNames, content:{f:"json"}, handleAs: "json", sync: true, load: dojo.hitch(this, "onLegendLoad"), error: dojo.hitch(this, "onLegendError") }; if(document.location.protocol==="https:"){ if(esri.id.credentials.length>0){ params.content["token"]=esri.id.credentials[0].token; } }
onLegendLoad: 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); },