I have reached exhaustion on a bug with my Google map.
The map populates fine on my version of Chrome, but doesn't on anyone else's or any other browsers.
It doesn't produce any indications of a struggle in the console. The codes imply doesn't populate the div with an id=map.
I will attach some screenshots of the results, my code, and the console.
- I have used my own API key, where it is expressed in the code...
The code:
<div id="map"></div>
<script>
var map;
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
center: {lat: 43.627489, lng: -79.662732},
zoom: 11
});
var request = {
placeId: 'ChIJ-2h986dAK4gRlDAADdqtUDo',
fields: ['name', 'formatted_address', 'place_id', 'geometry']
};
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 + '</div>');
infowindow.open(map, this);
});
}
});
}
</script>
<script async defer src="https://maps.googleapis.com/maps/api/js?key=KEYGOESHERE&libraries=places&callback=initMap"></script>
The consoles:
The results:
Please help me discover why this is only working on very specific versions of Chrome and none of the others.