HTML 5 Geolocation Not Working

If you have enabled the “Attempt to auto-locate the user” option on the settings page, and it doesn’t work in Chrome, Safari or Firefox, then this is likely because of an insecure connection.

Browser Support

Chrome

Geolocation API Removed from Unsecured Origins in Chrome 50.

Starting with Chrome 50, Chrome no longer supports obtaining the user’s location using the HTML5 Geolocation API from pages delivered by non-secure connections. This means that the page that’s making the Geolocation API call must be served from a secure context such as HTTPS.

Safari

Safari 10.0 release notes.

Starting in Safari 10.0, unencrypted websites can no longer access Geolocation APIs. You must use a secure connection in order to access Geolocation APIs.

Firefox

Firefox 55.0 release notes.

Sites that don’t use SSL can no longer access Geolocation APIs to determine a user’s physical location.

You can fix this by asking your host to install an SSL certificate, or by disabling the “Attempt to auto-locate the user” option on the settings page.

Mixed Content

When you do have a secure connection ( HTTPS ) and it still doesn’t work, then it’s probably due to mixed content being loaded. You can check this by opening the browser console in your browser.

If a mixed error shows up in the browser console, then the error itself often points to the file that causes the problem.

If it’s content you added yourself, then simply replacing http:// with https:// in the content will fix it. If it’s a remote file that triggers the error, then first make sure the external site supports https before replacing http:// with https://

WordPress and HTTPS guides