Yes I did! The doIdentify functionality was key. Here's the code:function initFunctionality(map) { dojo.connect(map, "onClick", doIdentify); identifyTask = new esri.tasks.IdentifyTask("http://InputYourMapServerAddress"); identifyParams = new esri.tasks.IdentifyParameters(); identifyParams.tolerance = 8; identifyParams.returnGeometry = true; identifyParams.layerIds = [0]; identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL; identifyParams.width = map.width; identifyParams.height = map.height;} function doIdentify(evt) { map.graphics.clear(); identifyParams.geometry = evt.mapPoint; identifyParams.mapExtent = map.extent; identifyTask.execute(identifyParams, function(idResults) {openIdentifyLinkResult(idResults, evt); });}function openIdentifyLinkResult(results){ if(results[0]){ var idResult = results[0]; if(idResult.feature.attributes.WEB){ window.open(idResult.feature.attributes.WEB); }}}
Alicia, did you ever get your code to work? I'm looking to accomplish the same thing...any help would be much appreciated. Thanks!
You would need to register an event handler for the layer's click event. By providing this event handler, you override the default click behavior of opening the info window.
If I understand, after your identify ( Are you using an identify?) just don't call the map.infoWindow.show() and use window.open(.......) to open the url contained in your attribute...
Is there a way to bypass the infowindow and go directly to a hyperlink (via an attribute containing a web address) by clicking on a feature? Or, to put it another way...Right now my script is setup for an info window, but instead of pulling up the infowindow upon clicking a feature, I want to go straight to a webpage. How could I accomplish this?
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.