1 addEventListener('load', function(e) {2 3 var geo_info = document.getElementById('geo');4 if (navigator.geolocation) {5 6 var geo = navigator.geolocation.getCurrentPosition(7 function(msg) {8 lat = msg.coords.latitude;9 lon = msg.coords.longitude;10 11 zoom = 16;12 13 url = 'http://maps.googleapis.com/maps/api/staticmap?center='+lat+','+lon+'&zoom='+zoom+'&size=600x300&maptype=roadmap&markers=color:blue|label:S|'+lat+','+lon+'&sensor=false';14 15 var img = document.createElement('img');16 img.src = url;17 geo_info.appendChild(img);18 19 },20 function(msg) {21 logger.log({error:msg});22 }23 );24 25 26 27 28 } else {29 geo_info.innerHTML = 'Sorry, your browser does not support Geolocation.';30 }31 32 33 }, true);34 35 36 37 38
Este ShareCode tiene versiones:
- Geolocation ... (24/04/2013)
- Geolocation ... (24/04/2013)
- Geolocation ... (24/04/2013)
- Geolocation ... (24/04/2013)
Enlace
El enlace para compartir es: