firefox-csshacks icon indicating copy to clipboard operation
firefox-csshacks copied to clipboard

Can the close button be disabled?

Open teknowledgist opened this issue 2 years ago • 4 comments

This is a crazy question and apologies if it is outside the scope of these CSS hacks.

I'm looking for a way to prevent accidental closure of a single-tab browser window. There is a nice AHK script/app called NoClose that will disable the close button for windows using standard (Windows) system window controls. It works in Windows for Firefox if the title bar is displayed. It doesn't prevent closure in numerous other ways, but does stop accidental clicks on the "X" in the corner.

Could something similar be done for Firefox using CSShacks when the title bar isn't displayed and/or in non-Windows?

Thanks!

teknowledgist avatar Jun 15 '23 16:06 teknowledgist

Certainly, you can simply use .titlebar-close{ display: none }

MrOtherGuy avatar Jun 15 '23 16:06 MrOtherGuy

Is that something that can be toggled on/off without a restart or possibly even per window?

teknowledgist avatar Jun 15 '23 17:06 teknowledgist

You can't achieve something like that with simply CSS. You could have an extension that toggles some specific window title for specific window if you like, and then use the existence of that window title prefix as a condition in your CSS to determine if the window close button should be hidden for that window. But yes, you would need an extension for that

MrOtherGuy avatar Jun 15 '23 17:06 MrOtherGuy

Got it. Not sure I want to learn how to make extensions just for this, but it's good to know.

Thanks!

teknowledgist avatar Jun 15 '23 17:06 teknowledgist