GoogleMapsPosition
by giacal
HTML
<script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyCdneRMEuZApMJr4bEuqHPmZIO5u_gJTQU&sensor=true"></script>
<div id="map_canvas" style="width:100%; height:100%"></div>
CSS
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map_canvas { height: 100% }
JavaScript
navigator.geolocation.getCurrentPosition(init);
function init(pos){
var div = document.getElementById("map_canvas"),
latlng = new google.maps.LatLng(
pos.coords.latitude,
pos.coords.longitude
),
opts = {
center: latlng,
zoom: 13,
mapTypeId: google.maps.MapTypeId.ROADMAP
},
map = new google.maps.Map(div ,opts);
}