Where did you install Firefox from? Help Mozilla uncover 3rd party websites that offer problematic Firefox installation by taking part in our campaign. There will be swag, and you'll be featured in our blog if you manage to report at least 10 valid reports!

Mozilla サポートの検索

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

このスレッドはアーカイブに保管されました。 必要であれば新たに質問してください。

How can I change the control + left click shortcut?

  • 2 件の返信
  • 1 人がこの問題に困っています
  • 9 回表示
  • 最後の返信者: KoenW

more options

Hello,

If I control + left click a link now, the link opens in a new tab. What I want, is that control + left click works as a normal click, so that the link opens in the same tab. Is that possible? So that control actually does nothing.

I have already read this topic and I managed to disable control + left click, but that is not what I want: https://support.mozilla.org/nl/questions/931230 I think I should change the code a bit, but I don't know how.

Can anyone help me? Thanks!

Kind regards, Koen

Hello, If I control + left click a link now, the link opens in a new tab. What I want, is that control + left click works as a normal click, so that the link opens in the same tab. Is that possible? So that control actually does nothing. I have already read this topic and I managed to disable control + left click, but that is not what I want: https://support.mozilla.org/nl/questions/931230 I think I should change the code a bit, but I don't know how. Can anyone help me? Thanks! Kind regards, Koen

選ばれた解決策

Here's the revised version for you:

// ==UserScript==
// @name        Ctrl+click to Regular Click
// @namespace   YourNameHere
// @description Change ctrl+left click to regular click on all sites
// @include     http*://*
// ==/UserScript==
function overrideCtrlClick(e){
  if (e.button == 0 && e.ctrlKey && e.target.nodeName == "A"){ // left button + ctrl key
    e.preventDefault();  // stop Firefox from processing 
    e.stopPropagation(); //   the user's Ctrl+click
    e.target.click();    // apply a regular click to the link
    return false;
  }
}
document.addEventListener("click", overrideCtrlClick);

Does that do what you want?

この回答をすべて読む 👍 2

すべての返信 (2)

more options

選ばれた解決策

Here's the revised version for you:

// ==UserScript==
// @name        Ctrl+click to Regular Click
// @namespace   YourNameHere
// @description Change ctrl+left click to regular click on all sites
// @include     http*://*
// ==/UserScript==
function overrideCtrlClick(e){
  if (e.button == 0 && e.ctrlKey && e.target.nodeName == "A"){ // left button + ctrl key
    e.preventDefault();  // stop Firefox from processing 
    e.stopPropagation(); //   the user's Ctrl+click
    e.target.click();    // apply a regular click to the link
    return false;
  }
}
document.addEventListener("click", overrideCtrlClick);

Does that do what you want?

more options

Yeah exactly what I want! Thanks a lot, made my day :)