Я использую Google Maps & Google Places API, чтобы отображать свои бизнес-данные на карте.На самом деле информационное окно открывается, когда я нажимаю на маркер карты, но моя цель заключается в том, чтобы информационное окно открывалось при загрузке страницы.
var infowindow = new google.maps.InfoWindow();
var service = new google.maps.places.PlacesService(map);
service.getDetails(request, function(place, status) {
if (status === google.maps.places.PlacesServiceStatus.OK) {
var marker = new google.maps.Marker({
map: map,
position: place.geometry.location
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent('<div><strong>' + place.name + '</strong><br>' +
/* place.formatted_address + '<br />' + */
place.address_components[1].long_name + ' ' + place.address_components[0].long_name + '<br />' +
place.address_components[6].long_name + ' ' + place.address_components[2].long_name + '<br />' +
place.rating + place.user_ratings_total + '</div>');
infowindow.open(map, this);
});
}
});