views:

247

answers:

0

I’ve got the following Google Map: http://fooo.org/GMaps/

When clicking on the icon, a custom overlay pops up. I want the users to be able to open the browser’s context menu on that overlay to copy the text or to open the links in a new tab.

The default behavior doesn’t allow this, because the underlaying map is eating up the respective events. To make it work, one has to catch these events at the overlay. Doing so works in WebKit and even in Internet Explorer, but unfortunately not in Firefox.

var stealEvents = ["mousedown", "dblclick", "DOMMouseScroll",
    "contextmenu", "click", "mousemove", "mousewheel"];

for (var i = 0; i < stealEvents.length; ++i) {
  google.maps.Event.bindDom(this.div[0], stealEvents[i], this, this._onClick);
}

Originally, I thought I just forgot to catch another event to make it work in Firefox, since in the official Google Maps info window, the context menu opens even in Firefox. But today I tried out Firefox 3.6 RC2 and now the context menu pops up.

So there might be a bug in Firefox prior 3.6. But why does the context menu shows up in the official Google Maps info window, even in Firefox before 3.6? I think there is a workaround, but I can’t look into Google Maps’ source code because it’s obfuscated.

I’ve already posted on the Google Maps group but haven’t got an helpful answer yet. Maybe someone of you can help.