). I don't want to ...">

How to make a Google Maps brand a simple URL?

I’m looking for a way to make the Google Map brand a simple link ( <a href=""> ).

I don't want to reproduce the link behavior with Javascript (e.g. location.href ), because I want the user to be able to open the link in a new tab or window (using middle click, for example).

Is there any way to do this?

+4
source share
3 answers

There is a workaround for this problem.

Thus, the average click / ctrl click / normal left mouse button has all the desired classic behavior , and the overhead is very limited.

This solution works for a full-screen map, because after "#" href there will be no effect. If you want this solution to work on a page that is larger than the height of one screen is high , you should also add a click event listener to block the event distribution when href is set to "#".

+1
source

Interesting idea. The only solution that comes to my mind is to use jquery to wrap each marker element in <a href="..." /> :

 $(something).wrap('<a href="..." />'); 

The problem is how to find all the markers, i.e. so that this expression is "something."

0
source

Since clicking on the marker is a javascript event, you can only use the location.href / window.open functions.

If you want to use standard html links, then your best option is to open the info window when the user clicks on the marker and has the content infowindow as an html link.

0
source

Source: https://habr.com/ru/post/1383737/


All Articles