We're calling on all EU-based Mozillians with iOS or iPadOS devices to help us monitor Apple’s new browser choice screens. Join the effort to hold Big Tech to account!

Zoeken in Support

Vermijd ondersteuningsscams. We zullen u nooit vragen een telefoonnummer te bellen, er een sms naar te sturen of persoonlijke gegevens te delen. Meld verdachte activiteit met de optie ‘Misbruik melden’.

Meer info

Deze conversatie is gearchiveerd. Stel een nieuwe vraag als u hulp nodig hebt.

How to disable keyboard shortcut CTRL+W?

  • 4 antwoorden
  • 3 hebben dit probleem
  • 1 weergave
  • Laatste antwoord van winserity

more options

Hello,

I am trying to disable keyboard shortcut CTRL+W, but there does not seem to be any options or addons for such issue. Is it possible to disable such keyboard shortcut? Actually, I am using CTRL+W into a gaming cloud which is accessible in browser. Thanks for your attention!

Best regards, Winserity

Hello, I am trying to disable keyboard shortcut CTRL+W, but there does not seem to be any options or addons for such issue. Is it possible to disable such keyboard shortcut? Actually, I am using CTRL+W into a gaming cloud which is accessible in browser. Thanks for your attention! Best regards, Winserity

Gekozen oplossing

You can possibly run code in the Browser Console to disable this shortcut, but that only works for the current window and you need to remember to run the code. The Browser Console has a command stack and remembers commands you have used, so you may only need a cursor UP to recall this code and press ENTER if you have used this.

I use this code to disable Ctrl+Q to avoid accidentally closing Firefox (Q is next to W). You can easily add more key IDs.


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_close");})()

You can possibly use a bookmarklet (bookmark with this code in the location field) to get this JavaScript code in a prompt and copy it to the clipboard.

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

Dit antwoord in context lezen 👍 1

Alle antwoorden (4)

more options

You can try something like this with code in the autoconfig.cfg file.

See also:

You need to remove this key binding for close tab (Ctrl+W):

<key id="key_close" data-l10n-id="close-shortcut" command="cmd_close" modifiers="accel" reserved="true" key="W"/>
more options

I'm glad that there is at least a solution. However, I have limited privileges (non-admin Windows user) to apply this solution. That would be great if such option could be integrated in the preferences tab in next update for Mozilla Firefox.

Thank you for your volunteer assistance!

more options

Gekozen oplossing

You can possibly run code in the Browser Console to disable this shortcut, but that only works for the current window and you need to remember to run the code. The Browser Console has a command stack and remembers commands you have used, so you may only need a cursor UP to recall this code and press ENTER if you have used this.

I use this code to disable Ctrl+Q to avoid accidentally closing Firefox (Q is next to W). You can easily add more key IDs.


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_close");})()

You can possibly use a bookmarklet (bookmark with this code in the location field) to get this JavaScript code in a prompt and copy it to the clipboard.

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

more options

cor-el said

You can possibly run code in the Browser Console to disable this shortcut, but that only works for the current window and you need to remember to run the code. The Browser Console has a command stack and remembers commands you have used, so you may only need a cursor UP to recall this code and press ENTER if you have used this. I use this code to disable Ctrl+Q to avoid accidentally closing Firefox (Q is next to W). You can easily add more key IDs.
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_close");})()

You can possibly use a bookmarklet (bookmark with this code in the location field) to get this JavaScript code in a prompt and copy it to the clipboard.

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

Thank you for such a great solution! You are genius :) Google provides so many threads regarding this issue, but none of them helped me as much as you. I have tried that javascript code, but it does not work or I don't know how to apply it. However, I have accessed the Browser Toolbox and deleted following node:

<key id="key_close" data-l10n-id="close-shortcut" command="cmd_close" modifiers="accel" reserved="true" key="W"/>

By deleting that node, I can use keyboard shortcut CTRL+W without to be closed browser tab. By the way, the correct link to documentation of Browser Toolbox is https://developer.mozilla.org/en-US/docs/Tools/Browser_Toolbox