最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Which Chrome keyboard shortcuts cannot be overridden with Javascript? - Stack Overflow

programmeradmin1浏览0评论

You can preventDefault() on Chrome shortcuts with JavaScript, but you can't do it with all of them.

Ctrl + S and Ctrl + F you can override.

Ctrl + W you cannot. This makes sense.

Ctrl + L though I was surprised to find you also cannot override though.

What shortcuts are overridable and which aren't in Chrome?

You can preventDefault() on Chrome shortcuts with JavaScript, but you can't do it with all of them.

Ctrl + S and Ctrl + F you can override.

Ctrl + W you cannot. This makes sense.

Ctrl + L though I was surprised to find you also cannot override though.

What shortcuts are overridable and which aren't in Chrome?

Share Improve this question edited Oct 20, 2022 at 20:04 Slbox asked Jul 9, 2017 at 15:53 SlboxSlbox 13.2k18 gold badges65 silver badges135 bronze badges 5
  • 3 bugs.chromium/p/chromium/issues/detail?id=33056 has some more information. – moltenform Commented Mar 13, 2018 at 22:59
  • 1 Ctrl-NTW, Ctrl Tab, Ctrl Shift Tab also appear to be non-overridable. Apparently Ctrl-Q can be overridden but not Ctrl-Shift-Q. – moltenform Commented Mar 13, 2018 at 23:00
  • 2 Ctrl+L can be overridden: the editor on this site has it as a shortcut for "insert link." I verified that it works in Chrome 88 (and also Firefox 87). – Ryan M Commented Jan 28, 2021 at 1:43
  • 3 Keymaster and Keypress have a lot of it figured out. Furthermore the DOM living standard of all things just states that "There are scenarios where invoking preventDefault() has no effect. User agents are encouraged to log the precise cause in a developer console, to aid debugging." – Swiffy Commented Jun 18, 2022 at 0:25
  • is it possible to overrider chrome incognito shortcut (Ctrl Shift N) using javascript? – Sagar Shah Commented Oct 4, 2022 at 6:22
Add a ment  | 

1 Answer 1

Reset to default 1

Within Chrome, here are the non-overridable mands that I have found:

Ctrl Tab, Ctrl-NTW, Ctrl-W

Most 'Ctrl-Shift' keyboard shortcuts are able to be overridden now with a few exceptions:

Ctrl Shift Tab, Ctrl-Shift-Q

Ctrl-L is now overridable along a few other new Ctrl-Shift shortcuts.

发布评论

评论列表(0)

  1. 暂无评论