views:

398

answers:

2

I have a script for a website, and one of the things ti does right at the end if attempt to disable an anti-right click protection in a website

if($("span[class=MembersNameDisplay]").exists()){
    var list_row = document.getElementsByTagName('script');
    if(list_row != null){
        list_row[0].parentNode.removeChild(list_row[0]);
    }
}

document.oncontextmenu=new Function("return true");

In google chrome this works, however in firefox with greasemonkey, the last line fails and the protection is not removed.

Error: Component is not available Line: 171

How do I fix this, and why does it fail under firefox?

A: 

Al little search on Userscripts.org showed me multiple solutions.

jerone
A: 

Judging by this post, which I have used for a mouseup event, you should be able something like document.addEventListener("contextmenu", new Function("return true"), true).

js