RSS Feed

Disable Right Click on Web Page using jQuery

September 22, 2011 by Sourabh Sharma

This is very simple article that will tell you to disable right click on your web page. This is an ASP.NET Application to prevent right click options from the users. I have used jQuery script to do this.


 


Free Download

jQuery Disable Right Click : Demo Project

 

JavaScript Code to use jQuery LightBox:

 

<script src="http://ajax.googleapis.com/ajax/libs/jquery
/1.3.2/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript">
        $(function () {
            $(this).bind("contextmenu", function (e) {
                e.preventDefault();
            });
        });
    </script>



5 Comments »

  1. Nice brief post. Thanks!

  2. Yuriy S says:

    This is really user abusive and won’t stop anyone who’s determined to do what you’re trying to prevent (whether it’s downloading images or viewing source, or whatever…)

    I suggest you re-consider this technique.

  3. reloadown says:

    thank you Sourabh,this script is solid like a rock

  4. Trevor says:

    Good technique if you wish to disable the context menu. And since this is jQuery it’s not limited to asp.net but can be used anywhere javascript can be used.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>