Js keyboard event, pressing ctrl+t will open the new tab, how to disable

such as the title. I need to write a keyboard event, ctrl+t, but the current key combination will open a new page, do not execute my js method, excuse me, how to solve-sharp-sharp-sharp topic description

if (oEvent.keyCode = = 84 & & oEvent.ctrlKey) {

emit.$emit("keyAlign","ico4")
/*FF  */
  setTimeout( () =>{
  },1);
return false;

}

Jun.30,2021

In Chrome4, certain control key combinations have been reserved for browser usage only and canno longer be intercepted by the client side JavaScript in the web page.
These restrictions did not exist in Chrome3 and are inconsistent with both Firefox3/3.5 and IE7/8 (on Windows).

These combinations cannot get captured by Javascript, but embed plugins can capture these. For example if you focus in a Youtube video and press Ctrl+T, the browser won't open a new tab.

javascript-capture-browser-shortcuts-ctrlt-n-w


Don't bother with system-level operations. You can't prohibit ctrl+c from copying.


what browser? Some browsers, such as chrome, cannot intercept ctrl+t.

Menu