Prevent Google Chrome for being Accidentally Force Close

Firstly, you need to pin a site (example I pin Then you need to install User Javascript and CSS extension.

User Javascript and CSS

Then, go to tab pinned tab! And click User Javascript and CSS extension you just installed, and add new.

Paste this code to javascript code (left side) :

window.onbeforeunload = function() {
return "You are closing all tabs.";

Then save it, and restart the pinned tab!

When you are trying to close whole browser, you will get this notice.

I wrote these tutorials for myself in future when I forget for the next steps.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store