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?
There is a workaround for this problem.
- Wrap your google map div with href = "#"
- Set the mouseouver and mouseout events of the markers to update the href link (mouseover sets the link to the page corresponding to the marker, mouseout will return it to "#").
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 "#".