Skip to content

Instantly share code, notes, and snippets.

@siddharta1337
Created July 18, 2012 19:16
Show Gist options
  • Save siddharta1337/3138211 to your computer and use it in GitHub Desktop.
Save siddharta1337/3138211 to your computer and use it in GitHub Desktop.
Prueba GPS
<!DOCTYPE html>
<html>
<head>
<title>Ejercicio GPS</title>
<meta charset="utf-8">
<script type="text/javascript" charset="utf-8">
var lectura
function mostrarPosicion(){
navigator.geolocation.getCurrentPosition(lecturaExitosa, error , {enableHighAccuracy: true } );
}
function lecturaExitosa(posicion) {
alert(' tu posicion es: Latitud ' + posicion.coords.latitude+'\n' + 'Longitud '+ posicion.coords.longitude )
}
function error(){
alert('no se donde estas');
}
// Cordova esta disponible!
//
function onDeviceReady() {
alert("listo")
}
</script>
</head>
<body>
<h1>Ubicacion del dispositivo</h1>
<div id="resultados"></div>
<button onclick="mostrarPosicion();">Mostrar Posicion</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment