hi,
I use gmap view to display nodes in a map. I would like to open marker link in a new window, not in the same window. Do you know how to do this ?

Comments

seschneck’s picture

I apologize if it's gauche to bump a year-old post, but I've been struggling for several days with the same issue, and having finally stumbled across the solution, wanted to share it. Edit /gmaps/js/marker.js and find

    // No content -- marker is a link
    else if (marker.link) {
      open(marker.link, '_self');
    }

Just replace _self with _blank. Obvious, really, but I was searching futilely for php-constructed hrefs, rather than checking functions.

NB: I'm using Drupal 6, so no promises that this will work in lower versions.

izmeez’s picture

subscribing. Thanks, this looks useful, will give it a try.

westbywest’s picture

I was able to accomplish this using the extlink module, although that causes all external links site-wide to open in a new window.

summit’s picture

Version: 5.x-1.0-rc1 » 6.x-1.x-dev

Hi, .js and ext link module didn't work both, sorry.
Anyone with another solution please?
greetings,
Martijn

marcoBauli’s picture

There's a newer duplicate issue which proposes a solution:

Gmap is great, but it does not allow developer to make a marker open a link in a new windows. So I made small change to make GMAP it work

Simply, just change marker.js

from
// No content -- marker is a link
else if (marker.link) {
open(marker.link, '_self');
}

to

// No content -- marker is a link
else if (marker.link) {
if (!marker.target) marker.target = '_self';
open(marker.link, marker.target);
}

So that we only need to add "target" property to marker, as following:

$markers[] = array(
'link' => url('node/' . $l['nid']),
'longitude' => $l['lon'],
'latitude' => $l['lat'],
'markername' => 'numbers',
'offset' => $i++,
'target' => '_blank',
);