Asp.net C# page Disable right click by jquery

Disable right click by jquery in asp.net web Page:

Disable right click by jquery:

In this post we give example of Disable right click on asp.net web application. The right click protection is basically used to protect the page content. 

 Some time we can copy the text from the web page content but if you have   some important content and you want to disable copy then you can use the Right click disable in asp.net. There is type you can disable right click by JavaScript and by jquery.

    Here we give a Example of jquery with code that disable right click on page.How to disable right click on asp.net web page using Jquery

JavaScript function for disable right click on asp.net page:

<script type="text/javascript">
        $(function () {
            $(this).on("contextmenu"function () {
                return false;
            });
        });
</script>

Asp.net web page code:

 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Rightclickdicable.aspx.cs" Inherits="Rightclickdicable" %>

<!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 id="Head1" runat="server">
        <title>Disable right click on web page using jQuery</title>
    <script Src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $(this).on("contextmenu", function () {
                return false;
            });
        });
</script>

</head>

<body>

    <form id="form1" runat="server">
    <div>
        text text text text text text <br />
        text text text text text text <br />
        text text text text text text <br />
        text text text text text text <br />
        text text text text text text <br />
    </div>
    </form>

</body>

Comments

  1. Great Article i have learned so many things from your article

    Please check this and tell me more about it:
    http://seowebsitedesigning.com/disable-mouse-right-click-using-jquery/

    ReplyDelete

Post a Comment

Popular posts from this blog