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
- /Users/
- 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:
-
- One needs to enable the Enable Access for Assistive Devices option, which can be found in the Universal Access system preference.
-
- Open the AppleScript editor, and type in the following commands :
<br /> tell application "Safari"<br /> activate<br /> end tell<br /> tell application "System Events"<br /> tell process "Safari"<br /> tell menu bar 1<br /> tell menu bar item "Safari"<br /> tell menu "Safari"<br /> click menu item "Private Browsing"<br /> end tell<br /> end tell<br /> end tell<br /> end tell<br /> end tell<br />
</li>
-
- Save this shiny new AppleScript as an application (.app file), and I called mine “PrivateSafari.app”.
-
- 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 :
- Open the AppleScript editor, and type in the following commands :