Show a warning dialog when closing a window containing multiple tabs.
WARNING: This extension apparently no longer works for Chrome in Windows 7 and possibly other versions also. I am no longer actively maintaining this extension, so this is unlikely to be fixed. You're welcome to try it out, but I think a proper solution would require modifications to the Chrome browser, and this is not possible through an extension.
You can view the extension's source code, feel free to experiment or to use this as a basis for a new extension if you can make it work better.
This extension adds a warning dialog to help protect against accidentally closing multiple tabs.
Whenever the browser tries to close a tab that is not currently visible, for example when closing a window containing multiple tabs, or when quitting the browser, it will prompt for confirmation. You can still close specific tabs or windows that contain only a single tab as usual without getting a warning.
(In case you're curious how it works: the extension adds a new beforeUnload handler to the oldest non-active non-empty tab in the window.)
- You may get spurious warnings if the protected tab auto-reloads automatically in the background, there is no way for a script to distinguish between that and a close event. The extension uses heuristics to avoid that, it helps if you have at least two non-autoreloading tabs in the window. You can also adjust the minimum age threshold through the extension's "options" link on the chrome://extensions/ page.
- The extension ignores non-http/https pages (such as ftp://, chrome://, or file://), and by default doesn't protect incognito windows. You can enable it for incognito pages on the chrome://extensions/ page.
- If you've just installed the extension, it will not retroactively protect pages that are already open. Only new windows get protected.
- Pages intentionally don't get protected until they've been open for at least a few seconds, and additional warning dialogs are intentionally suppressed for a few seconds after one was shown. This helps avoid spurious warnings, and shouldn't affect normal use, but can make it appear as if the extension isn't working if you quickly open and close windows to test it.
New in version 2.0: improved heuristics to avoid prompts for auto-reloading pages.
New in version 2.1: options menu, including configurable threshold for minimum page age.