Instant Safari Porn Mode

Every browser keeps track of your history. This is handy in most cases, like if you accidentally closed a tab and want to go back to it. But there are some instances when you don’t want your browsing tracked: you’re doing your banking, you’re searching on Google, you don’t want your wife to see all the porn you’ve been looking at. For those scenarios Safari’s Private Browsing mode has got your covered. You just go up to the Application menu and click. No problem. 

But what if you want to always visit a certain site in Private mode? You could open a new tab, type in the URL and go click the Private Browsing item. Sure it’s not an overwhelming amount of work, but why not automate it? (Bet you didn’t see that coming.) Apple doesn’t provide a keyboard shortcut for Private Browsing, so you could set one up in System Preferences and shorten the process a little bit. You’d still have to open the tab and type in the URL yourself though. 

Fortunately, Safari has decent AppleScript support and opening a new tab and setting its URL are things it will let you do. You can also script the clicking of menu items (even if it is a bit ugly). With all the pieces in place, here’s a script that ties everything together:

Not only will this script open your new tab, if it’s already open it will close it and exit Private Browsing mode. 

One unfortunate caveat for Private Browsing: you can’t apply it to a single tab; it apples to all tabs. So if you’re logged in to a web page in another tab and try to do anything with it, it will forget that you’re logged in. You can, of course, log in again.