Prevent Right-Click Context Menu Hijaak

Prevent websites from entirely disable web browser's Right-Click context menu by allowing use of SHIFT+RightClick, CTRL+RightClick, or CTRL+SHIFT+RightClick (configurable in the script code). This script is designed for Chrome and Chromium based web browsers. Firefox already has this feature built in via SHIFT+RightClick.

As of 2019-07-16. See the latest version.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Prevent Right-Click Context Menu Hijaak
// @namespace    https://greasyfork.org/en/users/85671-jcunews
// @version      1.0.1
// @license      AGPLv3
// @author       jcunews
// @description  Prevent websites from entirely disable web browser's Right-Click context menu by allowing use of SHIFT+RightClick, CTRL+RightClick, or CTRL+SHIFT+RightClick (configurable in the script code). This script is designed for Chrome and Chromium based web browsers. Firefox already has this feature built in via SHIFT+RightClick.
// @match        *://*/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(() => {
  //=== CONFIGURATION BEGIN ===

  //At least either SHIFT or CTRL should be set to true. 
  let useShift = true;
  let useCtrl  = false;

  //=== CONFIGURATION END ===

  let epd = Event.prototype.preventDefault;
  Event.prototype.preventDefault = function() {
    if ((this.type !== "contextmenu") || ((useShift && this.shiftKey) && (useCtrl && this.ctrlKey)) || (useShift && this.shiftKey) || (useCtrl && this.ctrlKey)) return;
    return epd.apply(this, arguments);
  };
})();