93
17
How to enable confirmation alert box option before closing opened tab in chrome browser? Need to change setting? I couldn't find any such options in setting window.
93
17
How to enable confirmation alert box option before closing opened tab in chrome browser? Need to change setting? I couldn't find any such options in setting window.
148
If you click "Warn before Quitting" in the Chrome menu on Mac it'll do the trick. It'll make you hold command + Q to quit. Not sure on PC.
This was huge for me because closing a tab, command + W is right next to close the whole freaking browser command + Q. Made that mistake too many times!
67I cannot understand why they would put that option in the Chrome menu rather than putting it in preferences. Anyway, thanks for this, I would not have thought to look in that menu. – SaganRitual – 2014-12-11T19:00:32.247
4Yeah, this is a setting, put it there. What nonsense. – kleinfreund – 2015-03-08T21:30:22.160
8What about for Windows OS? – Bort – 2015-03-21T00:52:56.107
It's probably in the menu bar because it's a global setting. All the other settings are per profile. Since you can have more than one profile I guess it makes sense to have this setting for all profiles at once, hence the menu bar. – Jeroen – 2015-07-14T12:58:02.237
9Where exactly is this option? I can't find it under the hamburger icon, nor in Settings. Not sure if it's been moved in Chrome v45 for Windows. – Danny Beckett – 2015-09-16T20:27:50.327
The setting is actually based in the preferences menu and not the usual 'settings' place. – Oliver Dixon – 2015-10-23T20:27:17.557
1Not only is the placement of this setting unusual (it's in the Chrome menu in the top left of the window on OS X) but it's something you would expect to be enabled by default. – Dennis – 2015-10-27T22:01:14.413
6So they just added this feature for Macs only? Not only that, are there only Mac users on Superuser? – Asaf – 2016-04-15T10:47:22.563
cant find either – Marcelo Filho – 2017-05-29T12:09:49.430
For chrome 65 on mac os sierra, if you click the "Chrome" entry on the menu bar (the first entry after the apple), the second to last entry on the drop down list says "Warn before Quitting". It doesn't look like a checkbox type of setting, but it is. Click it, close the menu, and go back and now you'll see it's checked- – chrismarx – 2018-04-17T15:48:42.890
Must only be for Mac. For Windows, the command to close the app is ALT+F4
. No way to confuse the two. Plus it always asks on Windows - actually no way to turn it off (that I know). – Chloe – 2018-08-31T00:31:44.363
17
If you close multiple tabs in your Chrome there is an alert box asking to "Close all the tabs?"
Yes Chrome closes the tab if you are pressing the X
button without any confirmation and it can be quite annoying if you accidently close it in order to do so. You can press CTRL + SHIFT + T To restore your previous session of all your tabs.
You could also look for a Chrome extension such as Windows Close Protector
5This Extension does not work anymore. Pig Toolbox does not work, too. So after Chrome Toolbox was kicked "Doube-click to close" and "multiple-close"-warning are not possible anymore. This really sucks. – mgutt – 2014-08-30T00:01:27.140
3Click the 'Chrome' button in the top left of your screen when in Chrome and then choose the 'Warn Before Quitting' option. – jimmyplaysdrums – 2016-02-03T03:38:55.970
You can restore your previous tabs... when you're not in incognito mode... – Adam Plocher – 2017-02-26T23:30:48.340
Please update the link. – Donald Duck – 2017-03-12T09:31:10.893
This page pinned or opened in your browser window makes sure that you see a confirmation box whenever the complete window is being closed - http://jsbin.com/pejejib - just bookmark the page and open it every time you start a session or maybe set it as a start-up page so you do not have to bother clicking on a bookmark each time you open your browser.
– Deepak Kamat – 2017-05-23T06:19:32.527Extension is working when closing browser. I need an option available in opera browser. I think chrome may not have such option. anyway thanks for your answer. – Kumar V – 2014-01-21T11:16:35.607
12
In my case the biggest problem is when I use ctrl-shift-W or ctrl-shift-Q. If you want to remap a shortcut:
Also, FYI: Ctrl-Shift-T will reopen all your tabs
2You, sir, are my hero of the day. I accidentally hit Ctrl+Shift+W at least once a week, and Ctrl+Shift+T never restores the windows to their original position (or monitor!). – Mike Strobel – 2017-03-30T20:07:22.747
1This is savior! Thanks. Keyboard shortcuts option can now be accessed by opening burger menu on the left side. – hims056 – 2019-03-01T07:13:25.467
11
Download and run NoClose (add it to the Startup folder if you want it to start with Windows).
Press Ctrl+1 to enable/disable the close button for the currently active window.
Install an extension that allows embedding custom JS to web pages. I used Page Modifier, but there are others available like JScript tricks and Custom JavaScript for websites.
If you chose Page Modifier, create a new script and enter the following JS code from kbeezie.com:
function PopIt() { return "Are you sure you want to leave?"; }
function UnPopIt() { /* nothing to return */ }
$(document).ready(function() {
window.onbeforeunload = PopIt;
$("a").click(function(){ window.onbeforeunload = UnPopIt; });
});
Set the Applied to
field to *
so the script runs everywhere,
and save it.
The script will only be executed on any new pages you visit thereafter. Already open tabs will need to be reloaded for the script to execute.
I haven't tested it extensively so it might not work for all web pages, but if you're good with code, you could probably tinker with it and fix the problems.
It works but it pops up for every tab, it would get annoying fast. – GinKin – 2015-02-26T21:13:50.740
@GinKin Isn't that the idea? A confirmation popup before closing any tab? – Vinayak – 2015-02-26T21:16:40.527
Not every tab, just when pressing the X to close the window, like how it works on Firefox. – GinKin – 2015-02-26T21:19:00.917
@GinKin You mean when multiple tabs are open and you're closing Chrome? – Vinayak – 2015-02-26T21:21:31.877
2Exactly. (15 characters to comment) – GinKin – 2015-02-26T21:24:03.533
@GinKin You can use NoClose for that. It's an AutoHotkey script that enables/disables the close button of the currently active window when you press Ctrl
+1
.
Do you use win8? – GinKin – 2015-02-26T22:31:26.037
@GinKin Windows 8.1. But it should work on any version of Windows. – Vinayak – 2015-02-26T22:34:43.563
It's so strange that NoClose works with everything other than chrome... With admin rights of course. – GinKin – 2015-02-26T22:47:16.843
Sorry I couldn't back then... – GinKin – 2015-02-27T10:10:05.500
@GinKin No worries. Can you now? – Vinayak – 2015-02-27T10:11:55.657
No longer works. – user2924019 – 2018-12-21T11:13:23.783
2
I believe the closest thing to this feature in stock Chrome is "continue where I left off" under the "On startup" section in settings.
@kumar_v This would be a very bad payment site. – mgutt – 2015-01-24T11:03:01.007
Continue where you left off does not work when you have multiple Windows open. (I had a case where I accidentilly hit Ctrl-Shift-w instead of Ctrl-w and for some reason, Ctrl-shift-t only opened the same tab multiple times, instead of recovering the window like normally) – Gert van den Berg – 2016-07-18T10:15:24.057
Yes. we can but i wrongly closed a payment page tab. so i can not reopen it as it will submit the payment second time. – Kumar V – 2014-01-21T11:17:42.830
2
I choose to trick "myself" on this. Open chrome, pin the first tab. That will eliminate the X button from that first tab :)
2It does not prevent Ctrl-W from working... (ctrl-shift-t works for unclosing individual tabs...) – Gert van den Berg – 2016-07-18T10:16:33.117
1
There is a "Chrome Toolbox" extension which is supposed to handle this, but it is no longer supported. So what I did on Mac OS is to change keyboard shortcut for quitting Chrome "Cmd-Q" to something which doesn't trigger accidentally (e.g. Ctrl-Cmd-Shift-Q) so I am sure I will never press it accidentally again.
To change this shortcut goto System Preferences > Keyboard > Shortcuts > App Shortcuts. Click on + sign, from App dropdown select "Google Chrome.app", for Menu Title type "Quit Google Chrome" and for shortcut, press a complex key combination.
1
An extension or a third-party software program to achieve this sounds like too much work. Some answers apply only to Mac while others requires you to add script runners in Chrome to inject a certain script in all pages which again causes a problem where the confirmation box is shown for all tabs.
I believe the need of most users here is that they want to protect the whole window from closing at once and not each tab. I have created a simple static HTML page with a bit of JavaScript that makes a confirmation box appear when the whole Window is about to close.
You can find the HTML page here (hosted on JSBin) : http://jsbin.com/pejejib
How to use it? The only requirement is that you have the page opened in Chrome always during a session so that whenever you have clicked on the "X" button or the keyboard shortcut to close the Chrome window, the script in the page I've created is run and asked for confirmation.
The benefits of this is:
For transparency, this is the JavaScript code in the page -
window.onbeforeunload = function(e) {
var dialogText = 'Are you sure you want to close the Window?';
e.returnValue = dialogText;
return dialogText;
};
Yes, that's all! Simple and straightforward.
1
I cannot post an answer because of reputation but this seems like a viable solution: https://www.cnet.com/how-to/how-to-prevent-closing-multiple-tabs-in-chrome/
Just keep the following link open in open in Chrome: http://www.maki-chan.de/preventclose.htm
Or create a custom tab with the code and set it as home page:
<script>window.onbeforeunload = function() { return "You are closing all tabs!"; }</script>
2
Those who want to follow the official um...how's a nice way to put it...never mind...thread, can do so here: https://bugs.chromium.org/p/chromium/issues/detail?id=147
– Kev – 2017-04-11T05:09:47.620