0

Saw the inverse of this request, but I am needing to be able to prompt the user to allow their location to be used in web browser each time a button is clicked, using javascript if possible.

My app is heavily-reliant on the user's current location, and I offer a button to plot current location on a map. If they "Block" that functionality the first time in their browser, it makes it hard to tell the user how to "go back and allow it for this site." So I am trying to force that prompt each time they click the button, even if they have "blocked" it once before. Is this possible?

Source Matters
  • 1,110
  • 2
  • 15
  • 35
  • We just help you with your code here, we don't do it for you. No code. No effort. -1. But, you should look at the answer [here](https://stackoverflow.com/questions/6092400/is-there-a-way-to-check-if-geolocation-has-been-declined-with-javascript). – StackSlave Dec 22 '17 at 23:58
  • [This](https://stackoverflow.com/q/20678707) question is similar but about Cordova/PhonaGap. Pretty sure that the same applies for regular web browsers. – Ivar Dec 23 '17 at 00:04
  • Have a boolean flag set to false if the user blocks geolocation, then have a function check if this is true or false whenever something is clicked. if true, proceed, if false, ask geolocation access then proceed. – Iskandar Reza Dec 23 '17 at 00:05
  • All you can do is display html info based on `navigator` status. you can't force the system prompt...that's why users are able to block it – charlietfl Dec 23 '17 at 00:23
  • @PHPglue ...that answer is so tiring. This isn't even a "code" question exactly, moreso a browser/system issue. Here's some code: (isResponseHelpful($user)) ? post() : goSomewhereElse() ); – Source Matters Dec 23 '17 at 01:05
  • thanks charlie - i'll take that approach (with browser-specific guidance provided). – Source Matters Dec 23 '17 at 01:07

0 Answers0