131
rated 0 times
[
136]
[
5]
/ answers: 1 / hits: 37748
/ 11 Years ago, tue, december 3, 2013, 12:00:00
Keep on getting this error in the console Uncaught ReferenceError: google is not defined. Been doing it for a while now but no luck. Any help greatly appreciated. Thanks in advance
<!DOCTYPE html>
<html>
<head>
<meta name=viewport content=initial-scale=1.0, user-scalable=no />
<style type=text/css>
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map-canvas { height: 100% }
</style>
<script type=text/javascript src=https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js</script>
<script type=text/javascript
src=https://maps.googleapis.com/maps/api/js?sensor=false>
</script>
<script type=text/javascript>
function initialize(location) {
console.log(location);
var mapOptions = {
center: new google.maps.LatLng(location.coords.latitude, location.coords.longitude),
zoom: 8
};
var map = new google.maps.Map(document.getElementById(map-canvas),
mapOptions);
}
$(document).ready(function()
{
navigator.geolocation.getCurrentPosition(initialize);
});
</script>
</head>
<body>
<div id=map-canvas/>
</body>
</html>
More From » html