Open external link from feature layer

2706
7
01-04-2016 12:40 AM
VojtěchBlažek1
New Contributor III

Hi,

I'am trying to make JS application - I want to open link in new window without making info or pop-up window.

I've got feature layer, where one atributte is URL, where are stored diferent links.

Something like on click function.

I heard something about ajax(?), but I'm new in Javascript and don't know where (or how) to start.

Thanks for advance

Vojta

0 Kudos
7 Replies
EvelynHernandez
Occasional Contributor III

Maybe u can use some of this...

var strWindowFeatures = "location=yes,height=570,width=520,scrollbars=yes,status=yes";
var URL = "https://www.linkedin.com/cws/share?mini=true&url=" + location.href;
var win = window.open(URL, "_blank", strWindowFeatures);

RobertScheitlin__GISP
MVP Emeritus

Vojta,

   Does the attribute field have a full url (i.e. http://www.someserver/something)?

0 Kudos
VojtěchBlažek1
New Contributor III

Yes attribute field is full url.

Thanks

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Vojtěch,

  How are you wanting people to get to activate the link if you are not wanting to use a popup info window?

0 Kudos
VojtěchBlažek1
New Contributor III

Pop up in smartphones are not good for me

0 Kudos
GirishYadav
Occasional Contributor

Hi Vojta,

Attach "click" event handler with FeatureLayer:

 on(featureLayer, "click", function(evt){
      var url = evt.graphic.attributes["urlFieldName"];
      var windowFeatures = "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes";
      if(url) window.open(url,'featureInfoWindow', windowFeatures );
 });

Hopefully this help.

-Girish

VojtěchBlažek1
New Contributor III

Thanks a lot for advices. I appreciate it

0 Kudos