summaryrefslogtreecommitdiff
path: root/public/static/geolocation.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/static/geolocation.js')
-rw-r--r--public/static/geolocation.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/public/static/geolocation.js b/public/static/geolocation.js
index 78b0691..63c08e8 100644
--- a/public/static/geolocation.js
+++ b/public/static/geolocation.js
@@ -22,8 +22,20 @@ $(document).ready(function() {
$.post('/_geolocation', {lon: loc.coords.longitude, lat: loc.coords.latitude}, processResult);
};
+ var processError = function(error) {
+ if (error.code == error.PERMISSION_DENIED) {
+ $('div.candidatelist').text('Geolocation request denied');
+ } else if (error.code == error.POSITION_UNAVAILABLE) {
+ $('div.candidatelist').text('Geolocation not available');
+ } else if (error.code == error.TIMEOUT) {
+ $('div.candidatelist').text('Geolocation timeout');
+ } else {
+ $('div.candidatelist').text('Unknown error');
+ }
+ };
+
if (navigator.geolocation) {
- navigator.geolocation.getCurrentPosition(processLocation);
+ navigator.geolocation.getCurrentPosition(processLocation, processError);
} else {
$('div.candidatelist').text('Geolocation is not supported by your browser');
}