diff --git a/app/templates/player_base.html b/app/templates/player_base.html index 866e40e..29bb2e2 100644 --- a/app/templates/player_base.html +++ b/app/templates/player_base.html @@ -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.')