1

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?

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>
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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