Auto-enabling Safari's Private Browsing

Reader Leo Campo is interested in Safari’s Private Browsing feature, but finds with it a measure of frustration. He writes:

I’m using Safari 4 beta on an Intel iMac under Leopard 10.5.6. I use the private browsing feature most of the time. Is there a way to make this Safari feature the default action? It gets old very fast always having to turn this feature back on every time I launch Safari, which for me, is several time a day.

Regrettably Private Browsing isn’t a feature you can leave on. When you quit Safari and launch it again, you’ll find that Private Browsing is turned off. And no, editing the com.apple.safari.plist file does you no good either. Safari just resets the option within the preference file when you next launch Safari.

If you're running Leopard you can, however, automate the process of enabling the Private Browsing option with AppleScript. Like so.

First, launch the Universal Access system preference and enable the Enable Access for Assistive Devices option.

Now, launch Script Editor (within the AppleScript folder inside the Applications folder) and enter the following script:

tell application "Safari"
	activate
end tell

tell application "System Events"
	tell process "Safari"
		tell menu bar 1
			tell menu bar item "Safari"
				tell menu "Safari"
					click menu item "Private Browsing"
				end tell
			end tell
		end tell
	end tell
end tell

Save the script as an application and then use that application to launch Safari. When you do, Safari will launch and Private Browsing will be enabled.

Updated to mention that this is a Leopard-only solution. It doesn't work with Tiger.

Subscribe to the MacWeek Newsletter

Comments