Click Feature to Open URL

10364
13
Jump to solution
05-06-2015 02:12 PM
ChrisHolmes
Occasional Contributor III

Hello, I`ve downloaded a story map template to work with (just the one for single map). I`m wondering if there is a way to set it up so that when a polygon in a map service is clicked that a url can be opened (url is stored as attribute for that specific polygon). So far everything I`ve seen has to do with using the popup window to access information, I`d really like to be able to just click the polygon and have that url specific to that polygon open up.

Thanks for any help!

Tags (1)
0 Kudos
13 Replies
AaronNepple1
New Contributor III

Jai Siva‌ Thank you. This code worked perfectly for me. #javascript api 3.x

Does anyone know how to make the feature label a hyperlink as well?

-Aaron

0 Kudos
AaronNepple1
New Contributor III

If anyone is still having issues with the labels not being clickable, Robert Scheitlin, GISP‌ outlined a fix in this thread:

https://community.esri.com/message/720934-re-workaround-to-ignore-a-label-layer-when-click?commentID... 

0 Kudos
MarquesMunson1
Occasional Contributor

I am trying this code for point features I have in an application I am building with JS 4.12.

  1. //Code for the specific URL to open in a new window  
  2.   featureLayer.on('click',function(e){   
  3.     var specific = e.graphic.attributes['SpecificAttribute']   
  4.     window.open("http://YourUrl.com/"+specific);  
  5.   });  

How would this code work for a feature layer where the link is in the attribute field. I have it in a field called Link. Right now I have it shown below but it is not working.

  1. //Code for the specific URL to open in a new window  
  2.   featureLayer.on('click',function(e){   
  3.     var specific = e.graphic.attributes['Link']   
  4.     window.open(specific);  
  5.   });  

0 Kudos
PhillipSherman1
New Contributor III

Do you know if it’s possible to add interactive arrows in ArcGIS Online web maps/apps? We have multiple facilities that accept different recyclable materials and our idea was to show an overview web map and have the arrows be clickable and interactive so that when a user clicks an arrow it takes them to a specific facility within the same app/map and so they can see the flow of materials from our county to the different locations.

0 Kudos