Skip to content Skip to sidebar Skip to footer

Html Navigator "User Denied Geolocation"

I have an issue with window.navigator, I'm getting error code 1, 'User denied Geolocation' whenever I run the following code as a local html file: navigator.geolocation.getCurrentP

Solution 1:

If you are using chrome, please have a look at the answer below:

HTML 5 Geo Location Prompt in Chrome

It appears this is a security restriction for the file protocol. Looks like you are going to need to host it locally from a server.


Solution 2:

A simple response that worked for me was to simply change my url from

localhost

to

127.0.0.1

Chrome asked me to confirm I wanted to share my location settings and I was away!


Solution 3:

Just click on the left side of the url on the little 'i' symbol:- (Refer the image below)

info symbol illustration

Then check if the location is 'block'. Change it to 'allow' and then reload the page.

Hope this helps.


Post a Comment for "Html Navigator "User Denied Geolocation""