How to disable closing Firefox 7 tab using ctrl+F4

2019-08-02 21:36发布

I have been browsing around to find a way to disable closing Firefox 7 tab using ctrl+F4.
Kind of hard to find an easy way to do it. Lock down browser security will help me using Firefox as a kiosk during the Linux Day event.

3条回答
我只想做你的唯一
2楼-- · 2019-08-02 21:53

Have you seen the keyconfig addon?

Or, more directly kiosk-related: R-kiosk

查看更多
爷的心禁止访问
3楼-- · 2019-08-02 21:59

In your Firefox address bar type about:config and hit enter you will be shown the warning to proceed with care, then look for the properties like

  • browser.tabs.warnOnClose,
  • browser.tabs.closeButtons,
  • browser.tabs.closeWindowWithLastTab.

You need to modify the binary values or change the boolean values from true to false or vice versa. If you don't have such entries, create them with right-click > New > Boolean.

PS: Please proceed with care.

查看更多
再贱就再见
4楼-- · 2019-08-02 22:09

Curious, I've never known CTRL+F4 is able to close the tab.

I've investigated the case a bit. I've tried disabling it in Keyconfig, but without success. The shortcut is not even listed there. When you try to add other shortcut to CTRL+F4 to override the default behavior, it still closes the tab.

Note that also CTRL+W is able to close the tab, but in this case you can disable it in Keyconfig.

Seems that CTRL+W and CTRL+F4 are handled different way therefore.

About CTRL+F4, I was able to find the following code:

http://dxr.mozilla.org/mozilla-central/browser/base/content/tabbrowser.xml.html, #else in line 2437:

#ifdef XP_MACOSX
          ...
#else
          if (aEvent.ctrlKey && !aEvent.shiftKey && !aEvent.metaKey &&
              aEvent.keyCode == KeyEvent.DOM_VK_F4 &&
              this.mTabBox.handleCtrlPageUpDown) {
            this.removeCurrentTab({animate: true});
            aEvent.stopPropagation();
            aEvent.preventDefault();
          }
#endif

I'm new to Mozilla code base, so I don't know where to search for CTRL+W however. But it seems CTRL+F4 is hardcoded at compile time for Windows and Linux and not easily (or at all) configurable.

You can think of reporting a bug to Bugzilla but I don't know if this would get top-priority treatment.

查看更多
登录 后发表回答