How to disable oncontextmenu="return false"

Discussion of general topics about Mozilla Firefox
Post Reply
BlueBeBe
Posts: 7
Joined: November 14th, 2002, 6:40 pm

How to disable oncontextmenu="return false"

Post by BlueBeBe »

Is there a way to disable one of this disturbing things in the page sources?

oncontextmenu="return false"
ondragstart="return false"
onselectstart="return false"

Thanks
jrt
Posts: 38
Joined: November 16th, 2002, 5:27 pm

Post by jrt »

No way that I know of, yet. See <a href="http://bugzilla.mozilla.org/show_bug.cgi?id=86193">bug 86193</a> for more info.
User avatar
edcatmur
Posts: 88
Joined: November 12th, 2002, 1:42 pm

Post by edcatmur »

You can do it with bookmarklets...

javascript:(function(){var H=["mouseover","mouseout","mousemove","submit","load","unload","resize","click"], Z=[], s="", j; function R(N,a){ while (N[a]) { Z[a]=Z[a]?Z[a]+1:1; N[a]=null; } } function zapEH(N) { var a,i,C; for (j in H) R(N,"on"+H[j]); C=N.childNodes; for (i=0;i<C.length;++i) zapEH(C[i]); } zapEH(document); for (j in Z) s += j + " (" + Z[j] + ")\n"; if(s) alert("Zapped event handlers:\n\n"+s); else alert("No event handlers found.");})();

(probably from http://www.squarefree.com/bookmarklets/ ) will zap various event handlers; pruning it to

javascript:(function(){var H=["contextmenu","dragstart","selectstart"], Z=[], s="", j; function R(N,a){ while (N[a]) { Z[a]=Z[a]?Z[a]+1:1; N[a]=null; } } function zapEH(N) { var a,i,C; for (j in H) R(N,"on"+H[j]); C=N.childNodes; for (i=0;i<C.length;++i) zapEH(C[i]); } zapEH(document); for (j in Z) s += j + " (" + Z[j] + ")\n"; if(s) alert("Zapped event handlers:\n\n"+s); else alert("No event handlers found.");})();

will zap those event handlers you refer to. Making it just zap those which have a value of "return false" would be possible but you would have to consider the permutations of that e.g. "return null;" "return 0;" "alert('Context menu disabled'); return (0==1);" "return (!true)" - to evaluate all of these in their effects would be an interesting but pointless exercise.
Post Reply