I'm trying to implement a Google Maps v3 Asynchronous map into my site, and have it nearly identical to the how to. No map loads on the page though! Does anyone see anything wrong here?
<script type="text/javascript">
google.maps.visualRefresh = true;
function initialize() {
var mapOptions = {
zoom: 18,
center: new google.maps.LatLng(42.7870,-86.1023),
mapTypeId: google.maps.MapTypeId.SATELLITE
};
var map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
}
function loadScript() {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://maps.googleapis.com/maps/api/js?sensor=false' +
'callback=initialize';
document.body.appendChild(script);
}
window.onload = loadScript;
</script>
and
<div id="map-canvas"></div>
The CSS for this page is very simple:
html, body, #map-canvas {
margin: 0;
padding: 0;
height: 100%;
}
Any thoughts?