In this article I am discussing how to write a simple JavaScript to disable right click on the page using JQuery.
Here I am using following jqueries. You can download from here.
Example:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DisableRightClick.aspx.cs" Inherits="DisableRightClick" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<title>jQuery disable right click</title>
<script type="text/javascript" language="javascript">
$(function() {
$(this).bind("contextmenu", function(e) {
e.preventDefault();
});
});
</script>
</head>
<body>
<h3>Disable Right Click</h3>
Purushottam Rathore<br />
India.
</body>
</html>
Copy and paste this code into your application and see the result.

knightsPosted Jan 18, 2011, 10:43 AM
Hey Rathore, Good and quick reference.In my opinion, I would recommend these quick tricks should go in "How do i " section.What do you think ? Article conveys more broad knowledge and the explanation of concept i believe. It could also be putting technologies together to elloborate a concept. I hope you continue to share more of your expertise with all of us.Thank you.