Advertisement
ezidan

Geolocation Handling errors

Jan 18th, 2015
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function showError(error) {
  2.     switch(error.code) {
  3.         case error.PERMISSION_DENIED:
  4.             x.innerHTML = "User denied the request for Geolocation."
  5.             break;
  6.         case error.POSITION_UNAVAILABLE:
  7.             x.innerHTML = "Location information is unavailable."
  8.             break;
  9.         case error.TIMEOUT:
  10.             x.innerHTML = "The request to get user location timed out."
  11.             break;
  12.         case error.UNKNOWN_ERROR:
  13.             x.innerHTML = "An unknown error occurred."
  14.             break;
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement