I have some markers on a Google map and would like to open a new tab or window when they are clicked. I can only open the click URL on the same tab of the browser window.
Here's how it works now ...
var latlon = new google.maps.LatLng(MAP_FOCUS_LATITUDE, MAP_FOCUS_LONGITUDE);
var myOptions = {
center : latlon,
zoom : 14,
mapTypeId : google.maps.MapTypeId.ROADMAP,
mapTypeControl : false,
navigationControlOptions : {
style : google.maps.NavigationControlStyle.LARGE
}
};
var map = new google.maps.Map(document.getElementById("mapholder"), myOptions);
var marker = new google.maps.Marker(
{
position : new google.maps.LatLng(10.0,20.0),
title : "Blah",
url : "http://www.myurltest.com"
});
google.maps.event.addListener(marker, 'click', function() {
window.location.href = this.url;
});
In HTML, as a rule, you can do this to open the link in a new tab ... so how can I get this effect?
<a href="http://www.myurltest.com" target="_blank">Blah blah</a>
I would be grateful for any help!
source
share