Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

I'd like to set up a Google Map or any other map with pins in certain locations and have those pins link to other websites. Anyone know how I can do that?

Thanks

share|improve this question

1 Answer 1

You can use the following code:

<script type="text/javascript">
    var map = new google.maps.Map(document.getElementById('map'), {
      zoom: 5,
      center: new google.maps.LatLng(0,0),
      mapTypeId: google.maps.MapTypeId.ROADMAP
    });

    var MyPlace = new google.maps.LatLng(18, 78);

    var marker = new google.maps.Marker({
        position: MyPlace,
        url: 'http://www.wikipedia.org/',
        title: 'This link opens Wikipedia home page',
        map: map
    });

    google.maps.event.addListener(marker, 'click', function() {
      window.location.href = marker.url;
    });

  </script>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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