Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [code=javascript]
- <html>
- <body>
- <script>var Geolocalizacion = navigator.geolocation || (window.google && google.gears && google.gears.factory.create('beta.geolocation'));
- if (Geolocalizacion) Geolocalizacion.getCurrentPosition(MuestraLocalizacion, Excepciones);
- function MuestraLocalizacion(posicion) {
- alert(posicion.coords.latitude);
- alert(posicion.coords.longitude);
- alert(posicion.coords.accuracy);
- }
- function Excepciones(error) {
- switch (error.code) {
- case error.PERMISSION_DENIED:
- alert('Activa permisos de geolocalizacion');
- break;
- case error.POSITION_UNAVAILABLE:
- alert('Activa localizacion por GPS o Redes .');
- break;
- default:
- alert('ERROR: ' + error.code);
- }
- }</script>
- </body>
- </html>
- [/code]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement