Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Dec 2005
    Thanked 0 Times in 0 Posts

    Cool Prevent use of right mouse button with all browsers.

    Is there javascript available to keep someone from using the right mouse button while on my site that works with all browsers? The many that I have found work only with IE. With Netscape and Mozilla, the right mouse button is still active. Need one that will prevent the use of the right mouse button regardless of browser...Thanks

  • #2
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Near Chicago, IL, USA
    Thanked 32 Times in 31 Posts
    No, nothing will do that consistently across browsers.
    Thank goodness.
    Those of us with disabilities rather need it to navigate.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit

  • #3
    Senior Coder
    Join Date
    Nov 2003
    Minneapolis, MN
    Thanked 65 Times in 56 Posts
    If you run a search on this forum (you DID search for the answer before you posted your question, right?) you'll see about a zillion copy/paste scripts for this along with twice as many reasons not to do it.

    And, no, you cannot protect your site from theft. Besides, if you're just going to copy and paste someone else's javascript in your source code, I don't know what you'd have against others copying and pasting your source code.

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Sydney, Australia
    Thanked 666 Times in 655 Posts
    Opera completely ignores ANY attempt to interfere with the context menu attached to the right mouse button. Therefore there is no solution that could ever work for all browsers.
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


    Posting Permissions

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