Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Local development of geolocation chrome 50+

I am developing a website which require the use of the navigator.geolocation object through a local development environment on MACOSX. I am using Chrome 53. Considering geolocation is blocked on anything that isn't HTTPS how am I suppose to develop my website locally? The Google Developers site quotes:

Does this affect local development?

It should not, localhost has been declared as "potentially secure" in the spec and in our case geolocation requests served at the top level over localhost will still work.

Here's what I am seeing:

Geolocation console warnings

Any ideas? (aside from switch browser)

like image 341
Gavin Kemp Avatar asked Oct 27 '16 23:10

Gavin Kemp


1 Answers

http://localhost is treated as a secure origin, so you don't need to do anything, the Geolocation will work.

If you're using another hostname that points to the localhost (Ex: http://mysite.test) then you should run chrome from the command line with the following option: --unsafely-treat-insecure-origin-as-secure="http://mysite.test".

Example

google-chrome --unsafely-treat-insecure-origin-as-secure="http://yoursite.test"

More details on Deprecating Powerful Features on Insecure Origins

like image 138
Kerkouch Avatar answered Oct 14 '22 08:10

Kerkouch