Disable point-of-interest information window using Google Maps API v3

Solution 1:

UPDATE Google Maps JavaScript API V3

You can set clickableIcons to false in MapOptions. This will keep the POI icons but disable the infowindows just as you want.

function initialize() {
    var myMapOptions = { clickableIcons: false }
}

Further details here...

https://developers.google.com/maps/documentation/javascript/3.exp/reference#MapOptions

Solution 2:

See the other answers for the clickable: false answer.

However, if you want it clickable, but no infowindow, call stop() on the event to prevent the infowindow from showing, but still get the location info:

map.addListener('click', function (event) {
  // If the event is a POI
  if (event.placeId) {

    // Call event.stop() on the event to prevent the default info window from showing.
    event.stop();

    // do any other stuff you want to do
    console.log('You clicked on place:' + event.placeId + ', location: ' + event.latLng);
  }
}

For more info, see the docs.


Other option: completely remove the POI-icons, and not only the infoWindow:

var mapOptions = {
  styles: [{ featureType: "poi", elementType: "labels", stylers: [{ visibility: "off" }]}]
};
var map = new google.maps.Map(document.getElementById('map-canvas'),
    mapOptions);