How to Disable right click on body and images in web application.

Total Post:341

Points:2389

 1049  View(s)
Ratings:
Rate this:
I want to Disable right click on body and images in web application .how to do this please help me.
  1. Re: How to Disable right click on body and images in web application.

    Sometimes we required to prevent our web page images from being copied by another Persion.in that case we can secure our images by disabling right click or
     by disabling image context menu on images only. This is an effective approach to prevent our images from being copied  .Add the below event handler to the img  tag  and body as shown below:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Fourm.aspx.cs" Inherits="Forumasp.Fourm" %>
    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <script type="text/javascript">
            function disableRightClick() {
                alert("Sorry, right click is not allowed !!");
                return false;
            }
    </script>  
        <meta charset="utf-8">
        <title>jQuery UI Menu - Categories</title>   
    </head>
    <body  oncontextmenu="return disableRightClick()" >
    <img alt="Image" src="Images/1.jpeg" oncontextmenu="return disableRightClick()"/>

    </body>

    </html>

    c

      Modified On Apr-10-2018 06:58:27 AM

Answer

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.