No right click for netscape 6.1


can you post a solution that will disable the right mouse button in netscape 6.1(not 6.01)?
I tried lots of scripts, most of them work for 6.0 but not for 6.1
I tried something like

if(document.getElementById && window.sidebar){// if NN6
document.onmousedown = disableRC;
document.onmouseup = disableRC;

function disableRC(x){
if(x.which==2||x.which==3){//if not left mouse button
// what to put here ???

the only thing that seems to work is self.close(), but this is too rude(BTW this closes the NN6.1 window when you right click without any prompts or whatever).
Please post only things you tested, not something you think will work(i tried tons of these)


Who is Participating?
Y_eeConnect With a Mentor Commented:
this works in all browser

    var ie=Boolean(document.all);
    var ns4=Boolean(document.layers && !document.getElementById);
    var gecko=Boolean(!document.all && document.getElementById);
    function disableclick(e) {
        if (ns4) {
            if (e.which == 3) return false;
        } else if (gecko){
            if (e.button==2){
                return false;
    if (ie) document.oncontextmenu=function() { return false; }
    else if (ns4){
        if (ns4) document.captureEvents(Event.MOUSEDOWN);
    } else {

var ie5 = (document.all && document.getElementById) ? true : false;
var ie4 = (document.all && !document.getElementById) ? true : false;
var n6 = (document.getElementById && !document.all) ? true : false;
var n4 = (document.layers) ? true : false;
if (ie5) {document.oncontextmenu = function(){return false}}
if (n6) {document.onmouseup = function(e) {if (e.button == 3) return false}}
if(n4) {window.captureEvents(Event.MOUSEDOWN);window.onmousedown =
function(e){if( false;}}
if (ie4) { document.onmousedown = function(){return false}}
sphere301Author Commented:
Thanx avner, but did you really tested this with netscape 6.1?
Because it does not work for me, I can see the right click context menu with no problems :( in NN6.1
It works for IE 5.x & NN 4.x, but this is not what I'm interested in.

That's why I asked to post only tested (with NN 6.1) solutions.

Also please do not suggest scripts that use whatever kind of alert / prompt / confirm.
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Dear sphere301 ,
I tested the code.
I tested iton NS6 and it works.
It seems like NS6.1 behaves diffrently.
Best regards,
sphere301Author Commented:
Well what kind of NN6?
Is it 6.1 or 6.0x?
Because it does not work for my NN 6.1, which obviously behaves differently than any 6.0x in regard with this issue.
For your info, I use w2k pro / sp1 , if this matters, which I doubt.
I tested it on NS6.0
It seems like NS6.1 behaves diffrent then the NS6.0 .
I can suggest some options if you want , but I cannot test it because I do not have NS6.1  installed.
sphere301Author Commented:
Please post, something might work.
Although I think I tried evrything known so far , and simply nothing works .....
add to an onload method :


In the capturing function , test for a right click , and if it's a right click use :

Should work..
I turn off javascript (in any browser) and it's useless. I make a link to your page, right click on that (it's on MY page, remember, I can do whatever I want), choose SAVE AS and I have all your code, which I can then look at and modify to my heart's content.

Took all of... oh, maybe 5 seconds to overcome.

And you run the risk of alienating your users by implementing something that anybody who really wants the code (or graphic, or text) will be able to get past in seconds.

There ARE places where it is useful -- but they are few. If you're expecting this to 'protect' your code or graphics -- it ain't gonna do it. Better to put copyright notices on your pages and graphics, which at least allow you to sic lawyers on them when you see your stuff someplace.
webwoman ,
Sometimes you want to not allow right-click because you want to use the right click for the application you designed (for example right-column header for sorting) I belive this is the case.
Quite possibly, and I did say that it had valid uses. But I wanted to make sure that they realized that it's not going to protect anything, and is easily bypassed.

You know how often this gets asked, and almost always it's being used to try to 'protect' code or images.
webwoman ,
I agree with the comment.. but..
I think there is something wrong in your point of view.... Just a weird feeling I have.

In general I prefer thinking that must of the users try to protect the right-click for internal usage and not to "protect" their code/images.

In fact I would go with emphasizing how right-click can be disabled and adding a short comment about the fact that this is useless if someone wants to overcome it , but not the other way around.

And again , this is just my opinion with all the respect to you.

sphere301Author Commented:
Y_ee ,

this really works for NN6.1, but not for 6.0
Could someone post something for all NN 6.xx
sphere301Author Commented:
Well, sorry for my last comment.
A asked something and recieved a working answer, so it's honest to accept it, which I do now.
Thank you, Y_ee.
I'll handle with NN6.0.
It's really annoying that something works in X.0 version, but no way in X.1.
As for all the comments like "Why you need this", "This can't help in xxx situation", etc - I know all that. But since I'm asking, I need to know it. I know very well that disabling the right button will not prevent almost anything, can annoy the visitors, and in general the overall effect might be negative.
So I think posting such comments is not the right attitude in most cases.
For me, I'm doing a site for a customer, he wants that, period(of course I also tried to explain this is nearly useless)
If that's what they want, that's what they want. Not everybody listens to reason ;-)

Not everybody realizes that it doesn't do much (like your client). You might want to ask them to sign a statement that you've explained that it doesn't protect their copyright, doesn't provide any real protection to their content. Then, when somebody copies their graphics/words/etc. you can pull it out and remind them of that. ;-)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.