Below is the sample JQuery code snippet to disable right clicks on the page and prevent to viewing the source code or saving images from the page.
<%@ Page
Language="C#"
AutoEventWireup="true"
CodeFile="How to
disable Right Click on the page using JQuery.aspx.cs" Inherits="How_to_disable_Right_Click_on_the_page_using_JQuery"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD
XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.4.1.min.js"
type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$(document).bind("contextmenu",
function (e) {
alert('Right click disabled'); return false;
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<div> Test - Disable Right Click using JQuery
</div>
</div>
</form>
</body>
</html>
No comments:
Post a Comment