How to make Chrome warn you before closing

Chrome on Windows doesn't have a built-in warning dialog box before closing the browser. This workaround can help.

chrome logo

Personally, I don’t like browsers that throw up a warning dialog box when you try to close them with multiple tabs open. But I recently discovered that a lot of people do like this functionality, especially when they have dozens of browser tabs loaded. Unfortunately for those users, Chrome doesn't offer a warning box (even as an advanced option) on Windows.

If you want to see a warning before closing Chrome here’s a quick solution. Admittedly, it’s a bit of a hack, but it works.

Open the website Prevent Close by Germany-based developer Michael Armbruster. This website uses JavaScript to throw up a dialog box that asks you if you’re sure you want to leave that specific website.

The idea is to always leave that website tab open in Chrome. Then when you click the big red “X” to close the browser, this site throws up a dialog box asking if you’re sure you want to leave that page. If you click Stay the browser window will not close, if you click Leave Chrome shuts down.

It’s a neat little trick that uses a method less-than-reputable websites have been using for years. This time around, however, this little piece of JS magic is being used for good.

pintabcontextmenu

Use the Pin tab option to keep Prevent Close available in Chrome.

To make this as painless as possible, I recommend pinning this website to your browser then moving the tab out of the way. To do that open Prevent Close, and then right-click the tab with your mouse. From the context menu select Pin tab.

The tab will now shrink down to a different size from the rest of the tabs. Next, just grab it with your mouse and drag the tab to the far left of your browser’s tab lineup. In that spot it should be out of your way, but it will appear every time you start up your browser and prevent accidentally closing Chrome when it’s loaded with dozens of tabs.

Pro Tip: Chrome’s pinned tabs feature is a little tricky. Pinned tabs only appear in a single Chrome window, not every new window you open. To keep pinned tabs permanent, you need to close every other open Chrome browser window before closing the one with the pinned tab. In other words close it last or you’ll lose it. Something to keep in mind the next time you have YouTube or Netflix open in one Chrome window while working in another.

If you’re wondering why Chrome doesn’t offer a warning dialog on Windows, the best explanation I found was on a Google Chrome Help forum post. The lack of this “feature” is a philosophical choice. Google is focused on making Chrome as fast and simple as possible, which means stripping away extraneous features. A close dialog box is apparently one such feature. Chrome does have an option to enable a “warn before quitting” dialog on Mac, owing to the way keyboard shortcuts for closing windows and tabs work on that platform. Windows users, however, will have to make due with this hack.

To comment on this article and other PCWorld content, visit our Facebook page or our Twitter feed.
Shop Tech Products at Amazon
Notice to our Readers
We're now using social media to take your comments and feedback. Learn more about this here.