1

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?

Tom J Nowell
  • 9,588
  • 17
  • 63
  • 91

2 Answers2

0

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

jerone
  • 16,206
  • 4
  • 39
  • 57
0

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.
  • 1,787
  • 19
  • 22