6

Google and many other sites know my correct location. How can I fake my location without using a VPN, proxy, Tor or similar?

I went to about:config and looked for geo. What I think I have to modify is geo.wifi.uri? Maybe we can put in false lattitude and longitude values directly? If so, how would it look then? I really have no idea about the format.

Or is there another way using JavaScript in Greasemonkey?

13

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

  • Go to about:config.
  • Type in geo.wifi.uri.
  • 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.

  • Technically, you can often spoof geoip information directly without using a proxy, but that usually requires the IP being on an autonomous service which you have at least some influence over. – forest Apr 10 '18 at 4:14
  • 1
    This requires restarting Firefox. And please change that w3schools link to MDN or anything else! – user1338062 Jul 25 '18 at 9:31
2

As long as your traffic is going directly to them (that is, not through a proxy of some sort), they will have your IP and thus a rough geographic location.

How can I fake my location without vpn / proxy / tor etc.?

Why do you have this restriction?

  • Geolocation is a particular web API, I assume OP doesn't want to hide the IP but trick that API. – Arminius Jan 3 '17 at 23:27
  • @Arminius I think it is unclear if the question is about "the HTML5 geolocation API" or just "any geolocation techniques in general". – Anders Jan 4 '17 at 9:40
2

See https://developers.google.com/maps/documentation/geolocation/intro#responses but how you set it up differs between browsers. In Firefox it's through about:config. Set geo.wifi.uri to the path to the file, be sure geo.enabled is set to true, restart the browser.

A good test page is https://benwerd.com/lab/geo.php which should pull up the numbers you entered. My file looks like

{"location":{"lat":42.650515,"lng":-72.829819},"accuracy":5}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.