aspx Tutorial

NET Articles,jQuery demo, with jQuery, online tutorial,Jquery, SilverLight, Javascript,,JSON, MVC,.NET Articles,demo, Web Services,
Advertise Here


Get our toolbar!


Posted by Aamir Hasan   on Thursday, October 7, 2010 Total Views:  

You can easily find some javascript code over the internet to disable right click on your page. but jQuery make it so simple by using oneline of code.jQuery library provids a bind


Attaching behavior to a document is called bind(). I have bind contextmenu event to document.


.bind( eventType, [ eventData ], handler(eventObject) )

Why we disable right click

  • Most of people wants to disable right click in their site because of "Save as images" but there are other options to save image. Before going to display HTML and images, it is download on own machine, its mean you can easily take images from your machine.
  • To protect links to open in new tab. But, there are other options.

Add following code under the HEAD tag of your aspx page


script language="javascript" type="text/javascript" src=""></script>

    <script type="text/javascript" language="javascript">

        $(document).ready(function () {

            $(document).bind("contextmenu", function (e) {

                return false;





Click here to see demo and source code

Category: All | | jQuery
Protected by Copyscape Online Plagiarism Tool

Add comment

  Country flag

  • Comment
  • Preview

Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5