10.7: Remove Safari session auto-restore

Aug 03, '11 07:30:00AM

Contributed by: Anonymous

This hint describes how to not restore your previous browsing session after force-quitting Safari in Lion.

I disabled System Preferences » General » Restore windows... almost immediately after I discovered that Lion wants to automatically restore reopened applications to their previous state. Today while browsing with Safari I encountered one of those 'YOU WIN' sites that had a popup where the popup window lacks any controls except an 'Okay' button. That window held exclusive focus for Safari. Oh, and no red 'Close this window' button at the top-left either. The only intended way past this window was to click the Okay button. Very annoying, and I refuse to trust these sites since you don't really know what JavaScript or other code lurks beneath that Okay button. Note that you can't even view the page source since the popup has exclusive focus for the application.

So I did a force-quit on Safari as I've always done pre-Lion. When I restarted Safari this time though, my earlier session was restored including the popup. And now I'm in an ugly loop. If I crash Safari again, I'll be right back here the next time I start Safari. And I will not click that Okay button. Here's one workaround for this issue.

Kill Safari and then remove the file:

~/Library/Saved Application State/com.apple.Safari.savedState

After I did this, Safari restarted 'normally' just opening my default page. I used a Terminal window to remove that file, but you could use the Finder if you know how to access ~/Library in the Lion Finder. Search for the previous hints about this.

The truly cautious among us will want to rename that file rather than deleting it.

If anyone knows of a startup key/mouse combination to avoid restoring from the savedState file for a previously crashed application, I'd appreciate hearing how to do that. I searched and did not find anything.

[crarko adds: Good to know this. If there are key combos to launch Safari in Safe Mode please put your discoveries in the comments.]

Comments (16)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20110722125937252