How to prevent closing multiple tabs in Chrome

Want to prevent accidental closures when you still have lots of tabs open? Check out this workaround for Chrome.

Nicole Cozma
Nicole Cozma has an affinity for Android apps and devices, but loves technology in general. Based out of the Tampa Bay Area, she enjoys being a spectator to both sunsets and lightning storms.
Nicole Cozma
2 min read

Editors' note, August 31, 2015: This How To was originally published on January 9, 2012, and has been updated to include new information.

Whether you're researching or adding distractions in other tabs, it can be frustrating when you accidentally close them all at once. For Chrome users, no dialog box pops up asking if you're sure that you want to close all tabs, or even just the last one. Google has explained on several help threads that this is because it wants Chrome to have as little pop-ups or interruptions as necessary. But for those of us who just closed all 14 tabs we were looking at by mistake, that explanation isn't helpful.

Previously, this post mentioned a Chrome extension that could prevent you from closing multiple tabs. Unfortunately, that extension no longer functions, so you'll have to use a workaround method like the following for the time being:

  • Open this link in Chrome: http://www.maki-chan.de/preventclose.htm.
    This website was mentioned in a Google help thread, and was created to prevent your browser from closing. It mimics the behavior you see from a Gmail tab when an email is still sending.
  • You will need to remember to open this page each time you're using Chrome, so you'll want to bookmark it, or may even consider setting it as your Home page. You can do this by heading to Menu > Appearance section > Show Home button > click the Change link and set to the above website.

If you want to make your own webpage to perform this function, insert the following line into a text document and save it as a HTML file:

<script>window.onbeforeunload = function() { return "You are closing all tabs!"; }</script>

If you have an alternative method for preventing multiple tab closures, share it in the comments below!

(Via Google Chrome Help Forum)