Faking Geolocation in Firefox

One mild annoyance with Starlink is geolocation doesn’t work very well. A lot of sites identify me by my IP address, which is the satellite base station somewhere near Winters, CA 100 miles from me. Even if they use the browser’s geolocation API to get my location my computer, since I don’t have a WiFi connection Firefox seems to fall back on that same IP based location.

Anyway, there’s a simple solution in Firefox. Open the URL about:config and search for “geo”. Edit the value of geo.provider.network.url and change it from the default (a Google service) to a static answer. Here’s what I use, for Grass Valley:

data:application/json,{"location": {"lat": 39.22, "lng": -121.06}, "accuracy": 1000.0}

Note this JSON blob is not a Javascript Geolocation API response; it must be some special backend API. Mozilla has their own location API, I wonder why they use Google’s in Firefox?

It’d be nicer to have a browser extension to manage this for me. There used to be a consensus open source choice, Location Guard, but it hasn’t gotten an update for two years. There’s a bunch of spammy looking clones on the Firefox store I won’t trust. Location Guard might still work but when I briefly tried it I couldn’t see how to give out a specific location, only enable their privacy fuzzing.

Note that browser location spoofing won’t be good enough to fake out sites that really care what your location is. They’re probably using your IP address to locate you, or some other more devious means. But it’s a nice solution for ordinary apps that are just trying to do something simple.

Also note setting a single static location is probably a bad idea for a mobile device like a laptop or phone.