Utilitaires
Scripts
Divers
Jeux
Rechercher
Quillevere.net
Computer science thoughts

Allow geolocation in HTTP

24/01/2022

If you develop a website locally, you do not necessarily use an SSL certificate. Unfortunately, this blocks certain features, such as geolocation. Here's how to work around the problem.

Permission change for geolocation is locked to browsers: the option is simply not editable. You have to go through the hidden options of each browser (Chrome, Opera, Firefox) to authorize it.

Allow local geolocation on Opera

On Opera, the console displays the following message: "[Deprecation] getCurrentPosition() and watchPosition() no longer work on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details."

  • Enter the URL opera://flags/#unsafely-treat-insecure-origin-as-secure
  • Type in the box Insecure treated as secure the URL of the website to allow (ex : http://dev.mysite.fr)
  • On the drop-down box, select Enabled.
  • The browser will ask you to be restarted. Validate. Your local site now has access to geolocation.

Allow local geolocation on Chrome

On Chrome, the console displays the following message: "[Deprecation] getCurrentPosition() and watchPosition() no longer work on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details."

  • Enter the URL chrome://flags/#unsafely-treat-insecure-origin-as-secure

  • Type in the box Insecure treated as secure the URL of the website to allow (ex : http://dev.mysite.fr)
  • On the drop-down box, select Enabled.
  • The browser will ask you to be restarted. Validate. Your local site now has access to geolocation.

Allow local geolocation on Firefox

The error displayed in the Firefox console is "A geolocation request can only be fulfilled in a secure context.".

Unfortunately, no option is currently offered to allow local geolocation. And even if we managed to activate it (as in the screenshot opposite), it doesn't work.

Dernière modification le 24/01/2022 - Quillevere.net

Search in this website

fr en rss RSS info Informations