Enable Right Click

3 comments Permalink

UPDATE: Do not keep this script enabled, only use it as needed. It could cause some issues while browsing, as it loops through every HTML element on the page.

Greasemonkey script to reenable right clicking on sites that disable it for “security” purposes:

EnableRightClick.user.js

// ==UserScript==
// @name enable right click
// @namespace http://forrestledbetter.com
// @description enable right click
// ==/UserScript==

if (document.all)
{
iElements = document.all.length;

for (i = 0;i < iElements;i++)
{
document.all[i].setAttribute("oncontextmenu", "return true;");
}
}
else
{
iElements = document.getElementsByTagName('*').length;
aElements = document.getElementsByTagName('*');
for (i = 0;i < iElements;i++)
{
aElements[i].setAttribute("oncontextmenu", "return true;");
}

}

About Forrest

3 comments

  1. Tendron · September 28, 2007

    Thank you! I’ve been tinkering with something similar and getting less than perfect results.

  2. Forrest · January 27, 2008

    No problem! This is a handy one, but it will bring surfing to a crawl unless you only enable it when you need to right click something. I’ve written several others, but they were a bit more sensitive in nature…I’m working on getting them a little more generic for public use.

    I get so much useful code around the net, its nice to be able to help someone else for a change.

Leave a comment