Answer the question
In order to leave comments, you need to log in
Why doesn't Google Chrome ask permission to show geolocation?
I'm developing a site, and Google Chrome should ask permission to share geolocation. When the localhost host asks, and when I write project.test to /etc/hosts for 127.0.0.1, for example, geolocation is not asked for on this host, and it cannot be allowed in any way. Do I understand correctly, this is because, for the hostname NOT localhost must be https? for project.test is http, the browser perceives it as some kind of global, not local site, and therefore the location is prohibited by default?
Answer the question
In order to leave comments, you need to log in
Yes, this is true for chrome. Due to browser security requirements, it is allowed to use the JS Geolocation API only on the local domain, or only via HTTPS. In other browsers, except for chrome, it may be different.
If you open the browser console - most likely there will be an error / warning with an explanation about the protocol.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question