I am trying to use the ctrl and + combination within firefox for a different action for our web application. How could I prevent firefox from zooming when our web application is listening for this event? I do not want to change a setting within firefox, but would like the code to do this somehow. Any suggestions?
3 Answers
I don't think you can overwrite application shortcuts with website code. Imagine a site overwriting alt + tab, and suddenly you wouldn't be able to tab out of your browser window anymore. It is possible with some plugins, but that depends on the browser you're using.
Instead, use something that isn't a default keyboard shortcut to prevent other users from having the same problems. Everyone expects and counts on ctrl and +- to change their zoom level; overwriting this simply isn't a good idea usability-wise.

- 9,000
- 9
- 39
- 43
-
Overwriting alt+tab would be a very different thing, though! System is intercepting alt+tab before any application can receive it: the unique way to allow such a thing would be the browser hooks the system messages to intercept those keys before the system itself can. At that point, if the browser allow a full control of any keys to javascript code, a circumstance where the web developer makes the user unable to switch programs by that shortcut will be possible. – Davide Cannizzo Aug 25 '18 at 17:43
You could try Flash. Flash tends to gobble up a lot of shortcut keys, including Ctrl+T (new tab) which drives me mad all the time.

- 8,702
- 2
- 26
- 32
According to this resource http://www.arraystudio.com/as-workshop/disable-ctrl-n-and-other-ctrl-key-combinations-in-javascript.html, you should be able to prevent any control keys.
I have used similar techniques, by catching all events on the body tag, and if they are the F keys, then returning a false to veto.

- 54,176
- 10
- 96
- 129