Disabling right mouse button
Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Disabling right mouse button

  1. #1
    Banned
    Join Date
    Sep 2003
    Posts
    31

    Disabling right mouse button

    Hello, i was on this site and i tried to copy a picture, so as i could put it as my desktop picture.
    And it came up with this icon saying that i could not do that as it had been dissabled.
    And seeing as i am currently building my first web page
    I was wondering if anyone knew of the code for this action........?
    or a website were i could copy the code into my website's source code??
    Cheers and thanks

  2. #2
    I'd rather be fishing DjM's Avatar
    Join Date
    Aug 2001
    Location
    The Great White North
    Posts
    1,867
    You might also want to check out the GreekGoddess tut on protecting yourself from image theft.

    HERE


    Cheers:
    DjM

  3. #3
    Right turn Clyde Nokia's Avatar
    Join Date
    Aug 2003
    Location
    Button Moon
    Posts
    1,696
    function disable_right_click(e) {
    var browser = navigator.appName.substring ( 0, 9 );
    var event_number = 0;
    if (browser=="Microsoft")
    event_number = event.button;
    else
    event_number = e.which;
    if ( event_number==2 || event_number==3 || event_number==4) {
    alert ("Right/middle mousebutton is disabled");
    return (false);
    }
    return (true);
    }
    function check_mousekey () {
    var mouse_key = 93;
    var keycode = event.keyCode;
    if ( keycode == mouse_key )
    alert ( "Mouse Key Is Disabled" );
    }
    function trap_page_mouse_key_events () {
    var browser = navigator.appName.substring ( 0, 9 );
    document.onmousedown = disable_right_click;
    if ( browser == "Microsoft" )
    document.onkeydown = check_mousekey;
    else
    document.captureEvents( Event.MOUSEDOWN );
    }
    I cut and pasted this from a web sit I know that does not allow right mouse clicks.
    I dont know how accurate it is or even if it works, it could be a load of bollocks for all i know, but it might help you.
    Drugs have taught an entire generation of kids the metric system.

    http://tazforum.**********.com/

  4. #4
    Banned
    Join Date
    Sep 2003
    Posts
    31
    Thanks i will check it out........

  5. #5
    Right turn Clyde Nokia's Avatar
    Join Date
    Aug 2003
    Location
    Button Moon
    Posts
    1,696
    hope it works!
    Drugs have taught an entire generation of kids the metric system.

    http://tazforum.**********.com/

  6. #6
    Senior Member
    Join Date
    May 2002
    Posts
    344
    if you really want to disable your right mouse button, then do the following:

    a) go to a computer store and buy a mouse that is made by Apple Computers
    b) go home, unplug your mouse and plug in your new Apple mouse
    c) enjoy

    hehe
    Support your right to arm bears.


    ^^This was the first video game which i played on an old win3.1 box

  7. #7
    Banned
    Join Date
    Sep 2003
    Posts
    31
    nope it didn't work.
    But thankyou very much anyhow NOKIA, i c a positive AO point coming your way.
    And DJM there's also one for you.
    So thankyou both

  8. #8
    Junior Member
    Join Date
    Sep 2003
    Posts
    11
    y dont you try http://javascript.internet.com, http://www.freewarejava.com or http://www.javascriptkit.com these all give planty of "free" copy-paste javascripts you can find all what you dream of.
    enjoy

  9. #9
    Banned
    Join Date
    Sep 2003
    Posts
    31
    Thanks DION i will try em.
    (----special------Delivery-----------)
    (------oh--------my------it's-------a--------positive------AO--------point)

  10. #10
    Senior Member
    Join Date
    Jun 2002
    Posts
    311
    You like to fiddle with positive APS huh

    Ok - This one doesnt give you a prompt when you right click and still works when javascript is disabled

    <body oncontextmenu="return false" ondragstart="return false" onselectstart="return false" scroll="yes">

    I put it in the body section.

    Hf

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •