Search code examples
javascriptjqueryfirefoxgeolocationsecure-context

Enable HTTP Geolocation For Local Firefox Debugging


"A Geolocation request can only be fulfilled in a secure context"

Its great that HTTPS is needed for geolocation but I need to debug on insecure local server before it makes it to live.

I was hoping I could edit Firefoxes 'about:config' to disable this safeguard for debugging. How would I do this? Are there any other/better ways to debug location in insecure context? (mock https)


Solution

  • You can test on localhost without encryption

    Firefox will not send Geolocation over a non secure connection and this behaviour cannot be disabled. However, localhost is considered to be a secure connection so that might be an option when testing. This also explains why Christopher Supertramp could try his code over http- he's on localhost.

    This is from Mozilla documentation:

    Locally delivered files such as http://localhost and file:// paths are considered to have been delivered securely.

    https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts