Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="pt-br">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <script>
- var options = {
- enableHighAccuracy: true,
- timeout: 5000,
- maximumAge: 0
- };
- function success(pos) {
- var crd = pos.coords;
- console.log('Sua posição atual é:');
- console.log('Latitude : ' + crd.latitude);
- console.log('Longitude: ' + crd.longitude);
- console.log('Mais ou menos ' + crd.accuracy + ' metros.');
- };
- function error(err) {
- console.warn('ERROR(' + err.code + '): ' + err.message);
- };
- navigator.geolocation.getCurrentPosition(success, error, options);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement