4 Handy Ways to Prevent Google Chrome From Closing Accidently
Living on a browser has become a standard among people nowadays. Most of the work we do revolve around online services resulting in us having endless tabs open throughout the day. Sometimes, however, you accidentally hit the close button and before you know it, all your opened tabs in Chrome are trashed. Hence, we bring you a couple of nifty ways to prevent that from happening – by showing a warning message when closing a tab or by disabling the close button.
#.Prevent Chrome from Accidentally closing using a Website.
Probably the easiest way to prevent Chrome from closing accidentally is to keep a warning website open along with your other tabs. As soon as you tap the close button, Chrome will pop a warning window about terminating the browser, you can either continue or stay by clicking the respective options.
#.Disable the close button temporarily on Windows.
By following a couple of steps, you can as per your demands disable the close button of any application on Windows. To do so,
- Head over to this website and download the “NoClose.exe” file.
- Place it inside your startup folder.
- Run the “Noclose.exe” executable.
- You’re done. Now whenever you’re in Chrome or any other Desktop software, press “Ctrl+1” together to disable the “X” button. To enable, press the combination again. This works in most of all any other windows software out there.
Related: Enable Right Click on Chrome
#. Make use of Chrome’s own “Continue where you left off” setting.
Google offers a useful setting in Chrome itself that reopens all the tabs you had while you terminated the browser. To activate it, head over to Settings and click the “Continue where you left off” radio button. Now every time, you restart Chrome, you’ll have all the last session’s tabs load up automatically. Though, we won’t recommend this if you’ve a slow system or connection.
#. Insert a custom JavaScript code to get a warning from individual tabs on Chrome.
If you want a warning from each individual tab, a JavaScript code will need to be implemented on your browser. Don’t worry, it’s not that intimidating. First of all, download this free extension. Next up, hit that new icon on the top right corner and now fill the fields as shown below.
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; });
});
Hit “Save” and you’re done! Now, you’ll get a confirmation message from each tab when you click the close button. However, this can be frustrating if you’ve a lot of tabs open.
So, those were some of the ways you can make use of to prevent Chrome from closing accidentally, hope it helped. Let us know if we missed something or you’re stuck somewhere in the comments section down below.
Also see: Best of Chrome’s new tab extensions
Doesn’t work. Nothing happens and tab is closing as usual.
Which of the method is not working for you LidVan?
Here’s some extension I’ve designed – “Warn On Tab With Sound Closure” – it prompts the user on the tab closure if it is audible (wouldn’t guess, would ye?), you might find it useful: https://chrome.google.com/webstore/detail/warn-on-tab-with-sound-cl/jnheopnbicedafbmamohfffmafdcjelb
I’ve gotten Page Modifier installed and I pasted in your script and put “*” in the “Applied to:” field, but I don’t get a pop-up. It still allows me to close tabs without confirmation. I’ve turned off all other extensions and rebooted Chrome once just to be sure, but it’s still not working.
Any thoughts?
Sorry to hear Johannes that it did not work. I think the culprit are the quotes in the script. Can you please paste the script first in a notepad and then in the extension and see if that works?
Changing the double quotes to single quotes seems to have fixed it. The working script looks like this:
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; });
});
Glad to know it worked. I will fix the code in the article.
you cant restore private browsing tabs ^^ having a msg for each tab seems cumbersome and having to open a page that gives a alert takes up another tab and some ram, wierd that chrome doesnt has a alert function preventing you from closing all tabs., back to opera it is as firefox has been very chrashy of late
It’s 11/25/2019 and it’s not working unfortunately. No confirmation request when closing tabs.