Browse Source

console log geolocation errors

testing
Burathar 4 years ago
parent
commit
4b03e1f7b7
  1. 19
      app/templates/player_base.html

19
app/templates/player_base.html

@ -32,9 +32,26 @@ function sendLocation(position) { @@ -32,9 +32,26 @@ function sendLocation(position) {
});
}
function showError(error) {
switch(error.code) {
case error.PERMISSION_DENIED:
console.log("User denied the request for Geolocation.")
break;
case error.POSITION_UNAVAILABLE:
console.log("Location information is unavailable.")
break;
case error.TIMEOUT:
console.log("The request to get user location timed out.")
break;
case error.UNKNOWN_ERROR:
console.log("An unknown error occurred.")
break;
}
}
$(document).ready(function(){
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(sendLocation);
navigator.geolocation.getCurrentPosition(sendLocation, showError);
} else {
console.log('Geolocation is not supported by this browser.')

Loading…
Cancel
Save