How can you fake geolocation in Firefox?

If you want to spoof your location for the HTML5 Geolocation API you can follow these steps:

  • Go to about:config.
  • Type in geo.provider.network.url [it was geo.wifi.uri in previous versions]
  • Change the value to something like this:
    data:application/json,{"location": {"lat": 40.7590, "lng": -73.9845}, "accuracy": 27000.0}
    

(The lat and lng values determine the latitude and longitude of your location.)

  • Congratulations, you're now on Times Square! (You can test the result here.)

Note that if you want to prevent websites from deriving the location from your IP address you can't do that on the application layer - the only way will be a proxy.