8

I'm using Google maps in my mobile web app, but it I've noticed that sometimes when maps prompts for location permissions, users accidentally tap on "Deny" instead of "Allow" and they need to reload the page to be correctly located.

Is there a way to, i.e., have some JS call that users can trigger, let's say by tapping a button for example, to change their choice on giving location access permissions or make the browser re-prompt for them?

Thanks in advance for any help :)

Phill Pafford
  • 83,471
  • 91
  • 263
  • 383
Gerard
  • 9,088
  • 8
  • 37
  • 52
  • 1
    Related: - http://stackoverflow.com/questions/2471580/user-disallowed-geolocation-notify-user-second-time - http://diveintohtml5.ep.io/geolocation.html – Phill Pafford Nov 08 '11 at 17:59
  • I found a way to re-prompt for geolocation permissions, using – Gerard Nov 09 '11 at 20:09
  • Sorry, pressed intro by mistake. I found a way to re-prompt for geolocation permissions, using `navigator.geolocation.getCurrentPosition()` but it seems we can only prompt once again. I mean, if the user denies sharing their location twice, we cannot prompt for permission again. – Gerard Nov 09 '11 at 20:24
  • **Does anybody know a way to re-prompt for location services permission?** Though I managed to re-prompt once, this was never possible to me under android browsers... – Gerard Nov 11 '11 at 19:33
  • Another related question: http://stackoverflow.com/questions/4736057/geolocation-feedback-while-accepting-the-request maybe help into insight of how to reset/delet permissions – Phill Pafford Nov 11 '11 at 19:44
  • @Gerard, I didn't think two prompts are possible at all. Where both prompts from calls to getCurrentPosition? Or was the first prompt triggered by something else? – Fraser Feb 19 '12 at 12:52

1 Answers1

7

This is not possible, If the user opted out the best they can do is to clear their location settings to receive the prompt again. You can't force this, nor I believe should you want or be able to. After all where would it end.

Allow or deny? Are you sure? Sure you're sure? Positive you're sure? Etc..

See: http://support.google.com/gmm/bin/answer.py?hl=en&answer=1250068

The correct way to handle this would be to look for PERMISSION_DENIED and then display a message to your users such as "This application requires the use of location services, please enable them on your device to use this application" or some such.

Fraser
  • 15,275
  • 8
  • 53
  • 104