No right click for netscape 6.1

Posted on 2001-08-20
Medium Priority
Last Modified: 2008-03-10

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)


Question by:sphere301
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 3
  • +1
LVL 14

Expert Comment

ID: 6406209
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(e.target==document)return false;}}
if (ie4) { document.onmousedown = function(){return false}}

Author Comment

ID: 6406315
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.
LVL 14

Expert Comment

ID: 6406330
Dear sphere301 ,
I tested the code.
I tested iton NS6 and it works.
It seems like NS6.1 behaves diffrently.
Best regards,
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 6406379
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.
LVL 14

Expert Comment

ID: 6406416
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.

Author Comment

ID: 6406460
Please post, something might work.
Although I think I tried evrything known so far , and simply nothing works .....
LVL 14

Expert Comment

ID: 6406491
add to an onload method :


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

Should work..
LVL 19

Expert Comment

ID: 6407174
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.
LVL 14

Expert Comment

ID: 6407239
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.
LVL 19

Expert Comment

ID: 6407386
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.
LVL 14

Expert Comment

ID: 6407402
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.


Accepted Solution

Y_ee earned 400 total points
ID: 6407524
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 {


Author Comment

ID: 6410391
Y_ee ,

this really works for NN6.1, but not for 6.0
Could someone post something for all NN 6.xx

Author Comment

ID: 6424599
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)
LVL 19

Expert Comment

ID: 6424631
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. ;-)

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question