Google Maps infoWindow without marker?

Archdeacon picture Archdeacon · Oct 27, 2012 · Viewed 9.8k times · Source

According to the documention a marker is optional with an infoWindow, so how is this achieved please? I have tried infowindow.open(map) and infowindow.open(map,null) but both produce nothing.

Answer

mesmoll picture mesmoll · May 18, 2016

If the position is set, there is no problem showing the info window

function initMap() {
  var map = new google.maps.Map(document.getElementById('map'), {
  zoom: 6,
  center: {lat: 55.6761, lng: 12.5683},
  mapTypeId: google.maps.MapTypeId.TERRAIN
});
var infowindow = new google.maps.InfoWindow({
  content: "Copenhagen"
});
infowindow.setPosition({lat: 55.6761, lng: 12.5683});
infowindow.open(map);
}