Allow opening a new tab with Ctrl+T on all websites in Firefox

Posted by Martin J.H. on Super User See other posts from Super User or by Martin J.H.
Published on 2013-11-04T20:19:27Z Indexed on 2013/11/04 21:58 UTC
Read the original article Hit count: 340

Filed under:

In Firefox, certain websites and plugins (Adobe PDF Plugin) appear to "capture" the Control key, so that when I try to open a new tab using "Ctrl+t", nothing happens - or worse, something unexpected happens.

Examples:

  • On the Codecademy site, while editing code, Ctrl+T either does nothing, or (when Flash is disabled) switches the position of the two characters next to the cursor.
  • When viewing PDF's with the Adobe PDF Plugin, Ctrl+T does nothing.

Is there a way to disable this "feature"? I would like "Ctrl+t" to always "talk" to Firefox!

Edit: After searching superuser deeper, this question is very similar to the questions:

The answers to these questions are interesting and relevant, but do not give a method on how to disable combinatinos such as "Ctrl+t". Maybe a modified Greasemonkey script is the easiest solultion.

Edit 2 - Attempt at a solution The following UserScript (Use GreaseMonkey to install it) successfully captures Ctrl+t on some sites (Google Search site, for instance -> PopUp "Gotcha" appears), but not on the Codecademy site. I found another question pertaining to this subject here: "How to forbid keyboard shortcut stealing by websites in Firefox". It was raised in 2010, and the consensus was: It can't be done.

// ==UserScript==
// @name           Disable Ctrl T interceptions
// @description    Stop websites from highjacking keyboard shortcuts
//
// @run-at         document-start
// @include        *
// @grant          none
// ==/UserScript==

// Keycode for 't'. Add more to disable other ctrl+X interceptions
keycodes = [84];  
var lastPressedButton = [0];

document.addEventListener('keydown', function(e) {
    //uncomment to find out the keycode for any given key
    // alert(e.keyCode ); 
    if (keycodes.indexOf(e.keyCode) != -1 && e.ctrlKey) {
        e.cancelBubble = true;
        e.stopImmediatePropagation();
    alert("Gotcha!"); 
    }
return false;
});

© Super User or respective owner

Related posts about firefox