I am currently trying to build an app for employees to clock on and off from work each day.
I have currently setup geolocation to automatically get the location of the user and store it in a database however for obvious reasons if a user presses deny it cannot get the location.
Is there a way I can force location to be on for my page or prevent the page from loading if location is disabled.
I have managed to set this up with a function but if the user presses a not now button or select later the page still renders correctly and does not prevent the employee using the system.
What I need to do are the following:
Any help would be greatly appreciated.
I don't know how you're generating your page, but if you can rely on Javascript to render, or if redirecting to an error page in case of a denial is acceptable, you can use rely on the fact that you'll get an error callback in case of a denial:
navigator.geolocation.getCurrentPosition(success[, error[, options]])
So you site could either:
success
handler is called and show the error if not (after timeout)Now, to your "clear denial", I doubt this is possible. The best I can suggest is that you have instructions on clearing the geo settings on the error page. These will depend on OS and browser, unfortunately.