Disable right click menu (HTML)

Discussion in 'Web Design & Coding' started by madmatt, Oct 9, 2002.

  1. madmatt

    madmatt Bow Down to the King Political User

    Messages:
    13,312
    Location:
    New York
    I am too lazy to search for it, so maybe one of you can help me out quick. How do you disable the right click menu for a certain page so when you right click absolutely nothing happens. I know it can be done, I have seen it before, but like I said, I am too lazy to look for it.

    Thanks.
     
  2. biikman

    biikman Guest

  3. madmatt

    madmatt Bow Down to the King Political User

    Messages:
    13,312
    Location:
    New York
    Thanks for the link, however the code seems incomplete. I gave it a try, adding what I thought it needed, to no avail. Doesn't want to work. Any others? =)

    once again, I am lazy. I'm allowed, right?
     
  4. madmatt

    madmatt Bow Down to the King Political User

    Messages:
    13,312
    Location:
    New York
  5. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
    Code:
    <script language=JavaScript>
    var message="";
    ///////////////////////////////////
    function clickIE() {if (document.all) {(message);return false;}}
    function clickNS(e) {if 
    (document.layers||(document.getElementById&&!document.all)) {
    if (e.which==2||e.which==3) {(message);return false;}}}
    if (document.layers) 
    {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
    else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
    
    document.oncontextmenu=new Function("return false")
    </script>
    is what i use (just for reference) :p