Make Google Chrome Ask Before Quitting (Exit Confirmation)

Today, we will see how to make Google Chrome ask before quitting. The default behavior of this browser may be a bit annoying for the user, since it can be closed accidentally. Let's change this and make it show a warning before you close it.


Google Chrome is known for not having a confirmation option when exiting the browser under Windows. It is really strange, because under macOS, the appropriate option is available right in the app menu. But what about the Windows version? For some reason, developers haven't included it.

It is very easy to close the Chrome browser accidentally with one wrong mouse click or with the Ctrl + Q keyboard shortcut. If this happened to you, do not panic. The next time you open Chrome, press the following sequence on your keyboard: Ctrl + Shift + T. This will restore your tabs from the last browsing session.

Make Google Chrome Ask Before Quitting

To make the browser show a warning dialog before you quit it, there is a solution. A special web page, when opened, can show you a warning message via JavaScript code. You can try it yourself. Open the following web page:

Prevent Close

Now, try to close the Chrome browser. The result will be as follows:

Chrome Prevent Close Web Page Chrome Warning Before Quitting You can add this page to your home pages so it will be loaded automatically or pin the tab with the page. The main idea is to keep this page opened in your browsing session, so you won't close the browser accidentally any more.

Behind this trick is just one line of JavaScript code, which utilizes the "window.onbeforeunload" event. It's a very simple and clever solution.

If you are not happy to pin an external web page or press hotkeys, you can do the following. It is possible to set the Chrome browser to restore previously opened tabs automatically. Here is how it can be done.

In Chrome, click the menu button with three dots. The menu will appear on the right. Chrome Open Menu

Click Settings to open the Settings tab: Chrome Open Settings

Under "On Startup", enable the option "Continue where you left off": Chrome Restore Tabs Next Time

This will restore your previous tabs the next time you open Google Chrome.

3 thoughts on “Make Google Chrome Ask Before Quitting (Exit Confirmation)

  1. David Johnson

    I suppose some people like to be asked, but I find it rather annoying.

    Like or Dislike: Thumb up 1 Thumb down 0

    Reply
    1. Sergey Tkachenko Post author

      It depends.

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply
    2. MDJ

      Similar to Window XP’s shutdown confirmation.

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *