1

I'm a newbie in programming. I'm trying to make a href link inside of arcGIS js infoWindow (popup). I don't know how to make this link work. The code that I'm trying is shown below. Could you please suggest a solution?

    map.on("click", addPoint);
    function addPoint(evt) {
        var latitude = evt.mapPoint.getLatitude();
        var longitude = evt.mapPoint.getLongitude();
        var link = "<a href="www.google.com">Google Office</a>"
        map.infoWindow.setTitle("Coordinates");
        map.infoWindow.setContent(
          "lat: " + latitude.toFixed(7) + "<br> lon: " + longitude.toFixed(7) + "<br> Link: " + link
        );
        map.infoWindow.show(evt.mapPoint, map.getInfoWindowAnchor(evt.screenPoint));
      };
1

1 Answer 1

2

It should work if you replace "www.google.com" with 'http://www.google.com' (note the single quotes).

var link = "<a href='http://www.google.com'>Google Office</a>"
5
  • Thank you, but it does not open a link.
    – wossa
    Jun 10, 2015 at 17:08
  • Does the popup open? Do you get a link to click on in the popup, but nothing happens when you click on it? Or do you not see anything in the popop? Jun 10, 2015 at 17:31
  • Popup works but when I click on the link, nothing happens image here
    – wossa
    Jun 10, 2015 at 17:57
  • Edited the answer, just to make sure we are on the same page. Jun 10, 2015 at 18:23
  • @DanJurgella Can you please help me out at stackoverflow.com/questions/69630872/… Oct 20, 2021 at 7:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.