Solved! Go to Solution.
Do I have to remove the layer from the map, re-create the layer with the next URL, and add the layer back to the map?
Do I have to remove the layer from the map, re-create the layer with the next URL, and add the layer back to the map?
Note: if you add a dojo.connect statement to the layer, the statement ceases to exist when you delete the layer; when the layer is re-created and added to the map, you also have to re-create the connect statement.
var listener = dojo.connect(layerName, "onError", removeLayer); function removeLayer() { //disconnect the listener dojo.disconnect(listener); //code to remove the layer }
my URL switch code didn't work when more than one URL was invalid.