Поиск в Поддержке

Избегайте мошенников, выдающих себя за службу поддержки. Мы никогда не попросим вас позвонить, отправить текстовое сообщение или поделиться личной информацией. Сообщайте о подозрительной активности, используя функцию «Пожаловаться».

Learn More

Disable the stupid feature with browser closing by ctrl+q

  • 4 ответа
  • 1 имеет эту проблему
  • 44 просмотра
  • Последний ответ от cor-el

more options

Hi! Does anybody know how to disable browser closing by ctrl+q shortcut? It is too close to ctrl+w and sometimes I close the whole browser instead of one tab. Moreover it is really useless and stupid feature since I have alt+f4. Why I need another shortcut which do the same stuff? And why developers ignore this issue which was reported on several forums? I tried install extension which disable it but it doesn't work for me.

Изменено James

Все ответы (4)

more options

Web Extensions can't disable this command AFAIK.

I use this JavaScript code in the Browser Console to disable some shortcut keys. This code only works in the currently active window, so you need repeat this if you open more browsing windows.

javascript:/*ACCESSKEY*/(function(){var wd = Services.wm.getMostRecentWindow("navigator:browser").window.document;function $(e){return(wd.getElementById(e))}function $(e){var N=$(e);if(N){N.removeAttribute("key"); N.removeAttribute("command");console.log(N)}return($(e))}$("key_quitApplication");$("key_privatebrowsing");$("key_responsiveUI");})()

I use this bookmaklet to copy the code to the clipboard and paste it in the Browser Console when the command line history in the Browser Console doesn't bring it up as the first choice(s). If necessary you can clear the history via this command: clearHistory()

javascript:/*ACCESSKEY*/void(prompt('<accesskeys>',atob('amF2YXNjcmlwdDovKkFDQ0VTU0tFWSovKGZ1bmN0aW9uKCl7CnZhciB3ZCA9IFNlcnZpY2VzLndtLmdldE1vc3RSZWNlbnRXaW5kb3coIm5hdmlnYXRvcjpicm93c2VyIikud2luZG93LmRvY3VtZW50OwpmdW5jdGlvbiAkKGUpe3JldHVybih3ZC5nZXRFbGVtZW50QnlJZChlKSl9CmZ1bmN0aW9uICQkKGUpe3ZhciBOPSQoZSk7aWYoTil7Ti5yZW1vdmVBdHRyaWJ1dGUoImtleSIpOyBOLnJlbW92ZUF0dHJpYnV0ZSgiY29tbWFuZCIpO2NvbnNvbGUubG9nKE4pfXJldHVybigkKGUpKX0KJCQoImtleV9xdWl0QXBwbGljYXRpb24iKTsKJCQoImtleV9wcml2YXRlYnJvd3NpbmciKTsKJCQoImtleV9yZXNwb25zaXZlVUkiKTsKfSkoKQ==')));

more options

Hi jenamax, I'm aware of two ways to prevent immediate browser closure with the Exit/Quit shortcut. Note that I use Windows, in case your defaults are different on Linux.

(1) "Warn on close"

If quitting would close more than one tab, then Firefox can display a dialog for confirmation:

<center></center>

If you don't see that, you might double-check this setting:

(a) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button accepting the risk.

(b) In the search box in the page, type or paste CLOSE and pause while the list is filtered

(c) If the browser.tabs.warnOnClose preference is bolded and has a value of false, double-click it to restore the default value of true

(2) At least one tab has a beforeunload event handler set

You may occasionally have been saved by, or perhaps more often annoyed by, this warning:

<center></center>

When you exit, any tab with such an event handler should be focused and require you to respond to the question. (Assuming you have not set dom.disable_beforeunload to true in about:config.)

I created an extension to leverage that behavior which you can use to create such a tab. It's probably more useful for private windows, which Firefox may close without warning, but you need to make sure to enable the extension to run in private windows for that to work. If you want to take a look: https://addons.mozilla.org/firefox/addon/prevent-closing-window/

more options

See:

Only works on Windows and MacOS.
Doesn't work on Linux until this bug is addressed.
https://bugzilla.mozilla.org/show_bug.cgi?id=1325692
If you want to manually prevent the Ctrl-Q shortcut from working, open the global JavaScript console (Ctrl-Shift-J) and run the following code. This needs to be done for every new window.
document.getElementById('key_quitApplication').remove()

Изменено cor-el

more options

Firefox 87+ versions have a pref to disable Ctrl+Q.

  • browser.quitShortcut.disabled = true

You need to close and restart Firefox after toggling this pref.


You can open the about:config page via the location/address bar. You can click the button to "Accept the Risk and Continue".