---
title: "How to Disable right click on body and images in web application."  
description: "How to Disable right click on body and images in web application."  
author: "Anonymous User"  
published: 2016-01-03  
updated: 2016-01-03  
canonical: https://www.mindstick.com/forum/33825/how-to-disable-right-click-on-body-and-images-in-web-application  
category: "asp.net"  
tags: ["asp.net", "mvc", "web application"]  
reading_time: 1 minute  

---

# How to Disable right click on body and images in web application.

I want to [Disable](https://www.mindstick.com/forum/12901/how-to-disable-enable-input-box-in-aspx-with-value-from-sql) [right](https://www.mindstick.com/articles/12766/check-whether-you-are-doing-digital-transformation-right-or-not) [click](https://www.mindstick.com/articles/12423/social-login-magento-2-one-click-to-register-social) on [body](https://yourviews.mindstick.com/story/2120/rare-species-having-electricity-in-their-body) and [images](https://www.mindstick.com/interview/1067/what-is-the-php-predefined-variable-that-tells-the-what-type-of-images-that-php-support) in [web application](https://www.mindstick.com/articles/13069/progressive-web-application-pwas-all-you-need-to-know-about) .how to do this please help me.

## Replies

### Reply by Anonymous User

Sometimes we required to prevent our [web](https://www.mindstick.com/articles/12783/the-ultimate-bunch-of-free-web-design-resources) 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![How to Disable right click on body and images in web application.](https://www.mindstick.com/mindstickforums/dc8a982f-e64f-4731-8490-65e9a697e1d0/images/393bb293-331f-45cc-90dd-b37eab4e7e81.png)


---

Original Source: https://www.mindstick.com/forum/33825/how-to-disable-right-click-on-body-and-images-in-web-application

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
