..

Private Browsing with Safari

I use Firefox as my primary browser, both at home and at work. So I have setup my Safari browser, as my private browser – that is sans cache, history, cookies or anything of a similar nature. I noticed that the “Private Browsing” option in Safari, doesn’t do that good a job of not leaving files hanging around in one’s operating system, furthermore unless your careful, Spotlight will eventually end up indexing your browser history, cache, which may be less than ideal.

In order to have a zero cache safari instance on my laptop I have taken the following steps :

  • 1: Removed spotlight’s prying eyes, by excluding the following directories :
    • /Users//Library/Caches
    • /Users//Library/Safari
    • /Library/Caches
  • 2: Setup two cronjobs to constantly delete Safari cache-dir */10 * * * * find /Users/<USERDIR>/Library/Safari -type f -exec rm {} \; 2>&1 > /dev/null<br /> */10 * * * * find /Users/<USERDIR>/Library/Caches/Metadata/Safari/ -type f -exec rm {} \; 2>&1 > /dev/null </ul> </ul>

And finally, I have created a wrapper .app file which open’s Safari, and then enables “Private Browsing” mode, as I could not find a way to do this through editing the Safari.plist file. I followed the instructions posted on the MacWorld site, and they go a little something list so:

    1. One needs to enable the Enable Access for Assistive Devices option, which can be found in the Universal Access system preference.
    1. Open the AppleScript editor, and type in the following commands : <br /> tell application "Safari"<br /> &nbsp;&nbsp; activate<br /> end tell<br /> tell application "System Events"<br /> &nbsp;&nbsp; tell process "Safari"<br /> &nbsp;&nbsp;&nbsp; tell menu bar 1<br /> &nbsp;&nbsp;&nbsp;&nbsp; tell menu bar item "Safari"<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tell menu "Safari"<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; click menu item "Private Browsing"<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end tell<br /> &nbsp;&nbsp;&nbsp;&nbsp; end tell<br /> &nbsp;&nbsp;&nbsp; end tell<br /> &nbsp;&nbsp;end tell<br /> end tell<br /> </li>
      1. Save this shiny new AppleScript as an application (.app file), and I called mine “PrivateSafari.app”.
      1. I then grabbed the icon file from Safari, and added to the PrivateSafari, and then replace the old shortcut in my Dock, with one to “PrivateSafari.app”.</ul>

    It should be noted that I am well aware that the private browsing features in most of the modern web browsers have come under a certain amount of scrutiny recently, below are some links to articles for the interested reader :