JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://www.google.com/jsapi?bogusParam=.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&bogusParam=.js"></script>
<div id="map_canvas" style="width:600px; height:400px; margin:0 auto;"></div>
Click the marker to show info
JavaScript
function initialize() {
var gm = google.maps,
mapOptions = {
zoom: 1,
center: new gm.LatLng(0,0),
mapTypeId: gm.MapTypeId.ROADMAP
},
map = new gm.Map(document.getElementById('map_canvas'), mapOptions),
infoWindow = new gm.InfoWindow(),
marker = new google.maps.Marker(
{
map: map,
position: new google.maps.LatLng(
google.loader.ClientLocation.latitude,
google.loader.ClientLocation.longitude
)
}
);
gm.event.addListener(marker, 'click', function () {
var objInfo = JSON.stringify(google.loader.ClientLocation, null, '\t');
infoWindow.setContent('<pre>'+ objInfo +'</pre>');
infoWindow.open(map, this);
});
}
google.maps.event.addDomListener(window, 'load', initialize);