Stop Safari Auto-Refreshing Web Pages in Mac OS X Lion
A new addition to Safari 5.1 in Mac OS X 10.7 is that web pages auto-refresh if they are left inactive for a period of time. The feature can seem unnecessary and even annoying, but there’s no clear preference option to disable reloading of pages. Thankfully, Stormcloud (via DaringFireball) shows us how to stop this pesky behavior in Safari 5.1. Here’s the play-by-play to disable it:
- Quit Safari, then launch the Terminal (located in /Applications/Utilities/) and enter the following command
- Relaunch Safari and you’ll see a “Debug” menu appear on the far right, alongside “Help” (yes, this is different from the Develop menu)
- Pull down the new Debug menu and scroll down a ways until you see “Use Multi-process Windows” and select it so that it’s unchecked
- Open a new Safari window and if you see an [SP] next to the web pages title, you’re now in single process mode, which prevents the automatic refreshing of webpages
defaults write com.apple.Safari IncludeInternalDebugMenu 1
If you’re wondering why changing some setting called “multi-process windows” effects automatic reloading of web pages, Stormcloud provides a good description of what this feature is and how it works:
So what is a “multi-process window” anyway?
One of the new features in Safari 5.1 is a major new version of the underlying engine — WebKit2. Under WebKit2’s new process architecture, Safari consists of two separate processes — the “UI process” (the Safari application itself, including the address bar, toolbar, bookmarks bar, menus, etc.), and the “web process” (an independent process that loads and displays actual web pages).
Apart from other goals, the purpose of this is to provide some measure of crash protection. While it does prevent the entire Safari application from crashing (at least as far as I’ve seen), it doesn’t protect you from losing anything you’ve typed into text fields in web pages. All web content is handled by a single web process, so if any page malfunctions and causes the web process to crash, all open tabs will be reloaded, and anything you had typed into any of those pages will be lost. Furthermore, any downloads that were in progress will also be halted; you might be able to resume some downloads, but many will have to be started over. This can be very frustrating when downloading large files.
For that reason, the benefits of the new multi-process architecture are somewhat dubious, at least until Apple manages to address the issue of spontaneously reloading tabs (assuming it’s even possible to prevent this behavior without redesigning the overall architecture of WebKit again).
Basically, it’s a well intentioned feature, but it’s also causing some user headaches. In some cases it causes Safari to take up far more memory than it should, and it can even cause app slow downs. Presumably all of this will be fixed in a software update though.
The big caveat about running Safari 5.1 in single-process mode: many plugins and extensions don’t work, most notably (and annoyingly) ad blockers, ClickToFlash, and 1password. You’ll have to decide if that trade-off is worth it, or you can always just use Chrome or Firefox too.