Reputation: 916
The Google Maps API tutorial (https://developers.google.com/maps/tutorials/fundamentals/adding-a-google-map) is giving me a blank screen. I have been working on this for 3 hours and cannot figure it out.
I even copied/pasted the code exactly, it is saved as an .html file.
<!DOCTYPE html>
<html>
<head>
<style>
#map_canvas{
height: 500px;
width: 400px;
}
</style>
<script src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script>
function initialize() {
var map_canvas = document.getElementById('map_canvas');
var map_options = {
center: new google.maps.LatLng(44.5403, -78.5463),
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(map_canvas, map_options)
}
google.maps.event.addDomListener(window, ‘load’, initialize);
</script>
</head>
<body>
<div id="map_canvas"></div>
</body>
</html>
Upvotes: 0
Views: 1785
Reputation: 161334
You have illegal characters in your code:
Timestamp: 08/12/2013 02:08:39 PM
Error: illegal character
Line: 21, Column: 48
Source Code:
google.maps.event.addDomListener(window, $(B!F(Bload$(B!G(B, initialize);
Change:
google.maps.event.addDomListener(window, ‘load’, initialize);
To:
google.maps.event.addDomListener(window, "load", initialize);
Upvotes: 1
Reputation: 988
You need to add &callback=initialize
to your URL, that extra parameter tells Google that this is the function to call. That function must be accessible from the window
scope.
Upvotes: 0