infowindow.open(map) does not make sense, since you need to specify the position at which infowindow should open, it also has a tapering rod that indicates the place where it should be pointed.
According to the documentation, Infowindows-InfoWindows can be attached to Marker objects (in this case their position is based on the location of the marker) or on the map itself with the specified LatLng.
So, if you donβt want the marker to open the info window, use the map click event -
var iwindow= new google.maps.InfoWindow; google.maps.event.addListener(map,'click',function(event) { iwindow.setContent(event.latLng.lat()+","+event.latLng.lng()); iwindow.open(map,this); iwindow.open(map,this); });
And to close InfowWindow- infowindow.setMap(null);
Hope to clear your doubts.
Cdeez source share