How to make Chrome warn you before closing

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.

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.

IDG Insider


« How to crack the coding challenge


Onkyo DP-X1 high-resolution digital audio player review: It's a handful, but it's also sweet sounding and feature rich »
IDG News Service

The IDG News Service is the world's leading daily source of global IT news, commentary and editorial resources. The News Service distributes content to IDG's more than 300 IT publications in more than 60 countries.

  • Mail

Recommended for You

Trump hits partial pause on Huawei ban, but 5G concerns persist

Phil Muncaster reports on China and beyond

FinancialForce profits from PSA investment

Martin Veitch's inside track on today’s tech trends

Future-proofing the Middle East

Keri Allan looks at the latest trends and technologies


Do you think your smartphone is making you a workaholic?