Prevent Chrome tab being closed, unless confirmed

I like to keep my desktop clean, so often accidentally close the LW browser.

There is an apparently simple workaround - adding a single line of javascript.

This could be implemented on a setting toggle, defaulting to disabled.


When enabled, any attempt to close the tab on Chrome would bring up a requester asking if you are sure - and so prevent accidental closures.



References:


https://winaero.com/make-google-chrome-ask-quitting/

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


An implementation:

https://maki-chan.de/preventclose.htm




Login to post a comment