html - Geolocation alert won't stay on screen -


i trying implement basic geolocation on web app alert in chrome won't stay on screen; pops @ bottom disappears before can click of options.

geolocation alert won't stay on screen

you missing error handler function. try adding:

  var success = function(position) {     //do position   };   var failure = function(error) {     console.log('error occurred. error code: ' + error.code);     // error.code can be:     //   0: unknown error     //   1: permission denied     //   2: position unavailable (error response location provider)     //   3: timed out   };   navigator.geolocation.getcurrentposition(success, failure); 

also, consider adding {timout: 5000} (or other length of time) 3rd parameter, since function's default timeout search location infinity. see documentation on mdn.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -