Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. function getLocation()
  2. {
  3. if (navigator.geolocation)
  4. {
  5. navigator.geolocation.getCurrentPosition(showPosition);
  6. }
  7. else{x.innerHTML = "Geolocation is not supported by this browser, please manually enter your postcode above";}
  8.  
  9. );
  10. }
  11.  
  12. function showPosition(position)
  13. {
  14. x.innerHTML = "Latitude: " + position.coords.latitude +
  15. "<br>Longitude: " + position.coords.longitude;
  16. }
  17.  
  18. navigator.geolocation.getCurrentPosition(
  19. show_map, handle_error);
  20.  
  21. function handle_error(err) {
  22. if (err.code == 1) {
  23. // user said no!
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement