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
method
bind()
Attaching behavior to a document is called bind(). I have bind contextmenu event to document.
Syntax
.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
<head>
<script language="javascript" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function () {
$(document).bind("contextmenu", function (e) {
return false;
});
});
</script>
</head>
Click here to see demo and source code