Fake/randomize/delete geolocation in Safari for certain Websites

Solution 1:

I believe Safari will do something like this by default (Mac OS X 10.7.3, Safari 5.2).

If you look in the Privacy pane of Safari’s preferences, there’s a panel:

Limit website access to location services:

  • Prompt for each website once each
  • Prompt for each website one time only
  • Deny without prompting

I believe the first option is the default, so when you visit a page that wants geolocation data in the default setting, you get a panel like this:

A screenshot of benwerd.com/lab/geo.php, with a prompt from Safari asking whether the user wants to allow the page to access their location data. This page is a test of the HTML geolocation API.

In the default setting, the page will throw up that prompt every time I reload it (so if I click “Allow”, then refresh the page, I get the same prompt).

If I select the second option from above (“prompt for each website one time only”), then Safari will throw up that panel once, then remember your choice forever.

If you want to learn more, Apple has published two support articles on the topic:

  • “About Location Services in OS X Lion and Safari 5.1 or later”, http://support.apple.com/kb/HT5009, accessed 9 May 2012.
  • “About Location Services in Mac OS X v10.6 and Safari 5.0”, http://support.apple.com/kb/HT4239, accessed 9 May 2012.

Hope this is useful.


Addendum: I don’t know of any way to have Safari supply fake location data.