4

I'm using Ubuntu 22.04 and I have the issue of geolocation not working in Firefox snap (currently 119.0.1). Here are the steps to reproduce the issue:

  1. Enable location services in Ubuntu Settings → PrivacyLocation Services.

  2. Check in Firefox SettingsPrivacy and securityLocationSettings... permissions that the flag Block new requests asking to access your location is not enabled.

  3. Navigate in Firefox to: https://mylocation.org/

  4. Click Browser Geolocation.

  5. Click Start Test. A popup will ask you to allow the request.

    • Expected behavior: you get your latitude and longitude coordinates.

    • Actual behavior: latitude and longitude show Failed.

Please note that the Chromium snap can get the location correctly on the same site.

Can someone please confirm or deny the same behavior in the Firefox snap? Is there any workaround to get it working in Firefox snap? I love snaps so I would prefer a solution with the snap version of Firefox.

Borg
  • 93

4 Answers4

4

I've solved the problem by changing in about:config the value of geo.enabled from false to true. I have no idea why it was false.

However, please note that Chromium snap returns the correct location while Firefox snap returns a location 30 Km away, probably based on the IP address, but I really don't understand why.

Borg
  • 93
0

I had a similar issue on Ubuntu 22.04 with Firefox snap. Tried the same steps as you did. It worked fine in Chromium but failed in Firefox snap for some reason. I found that sometimes Firefox snap doesn't handle geolocation well.

One workaround I found was to use https://whatismylocation.org/. It worked better for me compared to other sites. Not sure why, but give it a try. Hope this helps!

Cheers!

0

Check that your Geoclue package is installed, and try starting the systemd service to ensure it works. It will auto-close in 60 seconds if it goes unused by an agent.

systemctl status geoclue
* geoclue.service - Location Lookup Service
     Loaded: loaded (/usr/lib/systemd/system/geoclue.service; static)
     Active: inactive (dead)

you may hardcode a location via /etc/geolocation file for security reasons.

https://forums.opensuse.org/t/howto-for-a-desktop-not-a-laptop-getting-a-localization-with-firefox/180014/5

Lastly, you can run this demo app to test your location: /usr/lib/geoclue-2.0/demos/where-am-i but first you need to have an AGENT running. ensuring the agent is running resolves most browser issues...

/usr/lib/geoclue-2.0/demos/agent &

To make this permanent, make sure the Agent is in:

/etc/xdg/autostart/geoclue-demo-agent.desktop

as well, under XFCE Application menu, the "Session and Startup" should have an autostart entry checked for "Geoclue Demo Agent"

Kevin
  • 1,031
0

I recently used https://whatmyzipcode.com/ and that was the top tool that showed me the best results compared to any other ones.