Google maps open info window by default?

If you want to show the info window opened by default without click, just add a new code like bellow:

Your code:

google.maps.event.addListener(marker, 'click', function() {
        infowindow.open(map,marker);
});

So we have a new code like this:

google.maps.event.addListener(marker, 'click', function() {
   infowindow.open(map,marker);
});

infowindow.open(map,marker);

As you can see, we just add a little line code with infowindow.open(map,marker);


You can run "open" directly on page load should open the window automatically, without a click.

infowindow.open(map, marker);

However, this might not autopan the map properly in some cases, leaving the top of the overlay off the edge of the map.

A way that worked for me is to wrap it in a listener to the "tilesloaded" event on the map

google.maps.event.addListenerOnce(map, 'tilesloaded', function() {
  infowindow.open(map, marker);
});