More of the same?


Geolocation: how to fake it or fix it in Chromium

Filed under: Desktop, Mobile, Software — _ds_ @ 14:06

After a little searching, I’ve found out how to set my location for desktop browsers without involving Google. There is sufficient detail there for any competent person to be able to appropriately configure Firefox, but it’s a bit lacking for Chromium and Google Chrome.

Quoting from the above page:

The way these geolocation services work is by requesting a file from Google which then responds with your location in JSON format. To fake this in Firefox, you can create a file on your computer with this text:

{"location":{"latitude":48.861426,"longitude":2.338929, "accuracy":20.0}}

You can find this location by locating it in Google Maps or any other maps program that supports Latitude and Longitude. Google maps generates a link that looks like the following:,2.338929&spn=0.011237,0.027874&z=16

In this case the first number is the latitude and the second the longitude.

The full name of the file should look, on GNU/Linux, something like /home/user/.config/location.txt.

To make Chromium respect your chosen location, you need to load ~/.config/chromium/Local State (on your common or garden GNU/Linux distribution etc.) and look for "geolocation" (complete with quotation marks); replace with the full path name of the file containing the JSON text describing your location, converted into a URL, so you’ll need to prefix with file:// and quote certain characters, e.g. spaces become ‘%20’ and, on Windows, backslashes become forward slashes. Using the above example name, you’ll end up with file:///home/user/.config/location.txt. Now save the file.

Do this while the browser is not running, else it’ll take no notice of your changes and will happily overwrite them.

While I couldn’t say for Google Chrome, I do expect that the only difference from Chromium is the file which you need to edit.

This allows me to properly attach my location to Google+ postings without having to rely on my phone, but it’s limited: I do still need to use the mobile browser version of G+ (which works fine in desktop browsers) if I want more control over the location, for example to use what Google call “your city-level location”.

(There is one error in the how-to, though: the example JSON text contains an extra number just before “longitude”.)



  1. Can you tell me what the text should look like inside the file? On Chrome it is apparently the file “Local State”, however I don’t have any text starting “geo” to edit in the first place. The SuperUser site has an answer that implies the same as what you have stated, but it also doesn’t show you what the text should look like, it just assumes that “geolocation” can be found within that file already.

    Comment by Peter — 2012-02-21 @ 10:50

  2. This is what you get by default (well, almost; I’ve omitted the token from the second string):

       "geolocation": {
          "access_token": {
             "": ""

    However, I’ve not had this working with newer versions of Chromium.

    Comment by _ds_ — 2012-02-26 @ 21:51

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog at

%d bloggers like this: