So I\'m working on a new web app that has a big focus on maps. Using Google Maps API v3 and really happy with it but noticed that the points of interest (POI\'s) have autom
No longer works, since update of Google Maps API.
I've found it finally!
Here is the demo: http://jsfiddle.net/fbDDZ/14/ (clicking "open" or POI does nothing, clicking "open please" opens InfoWindow)
The idea is to patch InfoWindow.prototype.open so to allow it accept the third argument. Google does not pass it, but we should.
The code:
function fixInfoWindow() {
var proto = google.maps.InfoWindow.prototype,
open = proto.open;
proto.open = function(map, anchor, please) {
if (please) {
return open.apply(this, arguments);
}
}
}
Google opens InfoWindow on POI like that:
myInfoWin.open(map, poiMarker)
The window will not open, because Google didnt say "please". That is how we should open our info windows:
myInfoWin.open(map, poiMarker, true);