GPS Location Error Function


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function positionError(err) {
  2. var msg;
  3. switch(err.code) {
  4. case err.UNKNOWN_ERROR:
  5. msg = "Unable to find your location";
  6. break;
  7. case err.PERMISSION_DENINED:
  8. msg = "Permission denied in finding your location";
  9. break;
  10. case err.POSITION_UNAVAILABLE:
  11. msg = "Your location is currently unknown";
  12. break;
  13. case err.BREAK:
  14. msg = "Attempt to find location took too long";
  15. break;
  16. default:
  17. msg = "Location detection not supported in browser";
  18. }
  19. document.getElementById('info').innerHTML = msg;
  20. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.