How to Disable Right Click on Website

Share on:

In this article, you will learn how to disable right click on website and also, with easy steps to prevent this copy and paste options on your web page. We have included all methods for different types of websites like WordPress, HTML Web Pages, PHP, ASP.NET, Blogger, Wix, and Shopify sites.

how to disable right click on website

If you want to protect your website content from visitors who will try to copy and paste all your web page information such as content, images, videos, and so on. Then, this article is for you.

Most of them will use this type of right clicking option to view the content of the web page of your website. If you would like to protect your website then you need to block this right mouse clicking. The following methods will help you to prevent others from doing rightclick on your website.

Methods for Disabling the right-click button on a Web page

Caution: Before applying the below methods to your web page to disable the right-click option, we would suggest you take a backup of your website files. This will help you to fix your website easier if something missed up.

Disable right click in HTML

how to disable right click in html

There are many methods to disable right-clicking on the HTML page. Out of all, we think the below-mentioned techniques are the easiest ones. We included a set of codes for JavaScript, jQuery, and CSS.

Method 1:

Disable right click on Website using JavaScript

Simply add the following programming lines in place of the default <body> tag mentioned on your HTML page.


Before adding code:

before adding javascript code to disable right click on website
before adding javascript code

After adding code:

after adding javascript code to disable right click on website
after adding javascript code

This javascript prevents website visitors from right-clicking on your web pages as the context menu won't appear to anyone. Further, this code blocks the keyword shortcuts like Ctrl + C, Ctrl + X, and Ctrl+ V.

It basically over rights the default user browser’s behavior.

Below is the complete breakdown of the code, so it helps you to understand easily;

  • oncontextmenu="return false;" - To hide the context menu to appear while clicking the right side button in the mouse.
  • onselectstart ="return false;" - Helps you disable the text selection.
  • oncopy="return false;" - prevents copying the content using Ctrl + C shortcut key.
  • oncut="return false;" - prevents cut option on the content using Ctrl + X shortcut key.
  • onpast="return false;" - Blocks the paste function using Ctrl + V shortcut key.

If you want to enable/allow any particular selection from the above, please remove that individual script and use it.

For example: If you want to enable the text selection option, then remove the code-named <onselectstart ="return false;">. so, the final lines of javascript code that you have to use will appear like the below;

<body oncontextmenu="return false;" oncopy="return false;" oncut="return false;" onpast="return false;">

So, based on your personal preference try to customize the code and use them.

Method 2:

Disabling right clicking in iframe using JavaScript

If you are using iframe to load the website and looking to block rightclick in iframe using javascript?. Don't worry, we are here to help you out! The main purpose of disabling it is to prevent users from saving any content from your website.

Use the following JavaScript programming lines on the iframe page.


Using this Javascript, you can easily prevent right-clicking in iframe.

Method 3:

Disabling right click menu in HTML page using jQuery

In this second method, you going to see How to disable right click on Website using jQuery.

You can use the below-mentioned jQuery code to block mouse right-click on any web page.


The main idea behind this code is to capture the onContextMenu event and return it as false. This will block users from accessing the context menu through the mouse right-click as well from the keyboard shortcuts.

Method 4:

Disabling right clicking on a Web page using CSS

As you all know that we are now trying to block using the user-select CSS property. In this method, we are assuming that the CSS region for turning off the clicks and specified as a body in your CSS file (body). When this particular method is used, all users won’t able to do any clicks.

Below is the CSS snippet, simply add to your CSS codes to get this things done on your web page.


Add it to your website’s CSS file and save it. All your visitors won’t be able to see the context menu. That makes them copy your content a bit tougher than others with enabled.

This is, how you prevent right-clicking using CSS scripts.

Disabling right clicking on Images in HTML

Have you kept Googling? and came across a bunch of improper or wronger codes to prevent right clicking on images in HTML?. Don't get frustrated. We are here to make you smile with the exact steps you need to do for securing your images.

Sometimes, it's necessary to prevent your images on a web page from being copied by others. You can achieve it by disabling image context menu on images only. This is a very good approach to protect your images from being stolen.

First, go to your HTML file and paste the following script once after the tag.


This code will help you disabling right clicks on all images in your HTML web page.

The script is used to disable the context menu and an alert box will be shown, once the user tries to click on the image.

You can customize the alert message with the text you what to show, by replacing the current text of "Image context menu is disabled".

If you don't want the alert box, then just delete script lines of [alert(alertMsg);] and [var alertMsg = "Image context menu is disabled";]

Once, added the script to your HTML web page. Check, whether the rightclick option is disabled or not for all your images.

How to disable right click on Website in PHP

how to disable right click on website in php

Disabling right clicking using the PHP codes is impossible because PHP runs on the server side but this particular clicking menu runs on client-side. And, these features are provided by the browsers, so we cannot disable, block or turn off it through PHP.

But, we have an alternate solution for this one. By using the following jQuery codes you can achieve this.


This jQuery code will help you disabling right-clicking in PHP websites. This solution is the one and only way that you can do for PHP web pages.

Disable right click in ASP.NET

disable right click in

If your web application / website runs under ASP.NET, then its necessary to prevent the easiest content theft ways like RightClick and copying option. So, to achieve it please follow the below step-by-step methods.

Go to your ASP.NET page and paste the following code in your head tag.


This script helps you to disable the right mouse click option on the ASP.NET web pages.

The user will also get an error message of 'This mouse action is not allowed!'. If you want to add any changes to the error message, then you can make your own changes and save it. This will show the text that you want to appear in the error message.

How to disable right click on WordPress website

how to disable right click on wordpress website

WordPress is one of the most popular content management systems that are easy to use and convenient to make different types of websites.

According to a recent survey made, more than 35% of websites on the internet are using WordPress as their CMS (Content Management System). So, there are many chances to get your content duplicated by others.

Stealing or copying the content from the websites, made by others, is not a good SEO practice.

Many people who perform this activity for their own personal profit may be affecting your website. So, protecting the content on your website is very important.

  • Here, we are going to show you two methods for disabling right-click menu on your WordPress website.
    1. With Plugin
    2. Without Using Plugin

So, these two methods will help you to keep your website data's safe and secured.

Disable right clicking in WordPress website with Plugin

Before knowing the exact WordPress plugin for disabling right click menu on your website, let's see What is plugin? and How does it work in WordPress?

A plugin is known as a software that comes up with huge number of functions that can be added to any WordPress website. They are used to add any new functions or new features to your web page.

All plugins are coded in PHP programming language and they can be added seamlessly with your web page. Plugins make users add any features to their website easily without any coding skills.

There are millions of WP plugins are available as free (or) paid, officially at the WordPress plugin directory.

It's Time to Reveal the Plugin: There are many plugins to do this function, but out of all we have picked the best one to make sure there are no bugs or major speed issues that usually appear after the plugin installation.

It's time to reveal it, the wp plugin name is WP Content Copy Protection & No RightClick and this plugin is completely FREE.

This wp plugin protects your content from being copied by site visitors. The plugin protects all your posts and pages by multiple techniques that use the combinations of JavaScript and CSS, this new technique can't be found in any other WordPress plugin out there.

WP Content Copy Protection & No Right Click Plugin features:

  • Disables right-click (context menu) and shows the alert message on the click.
  • It protects your content from text selection and copying.
  • This WordPress plugin also disables the save option on images from your website. So, no one can reuse your images.
  • Disables the following keyboard shortcuts like CTRL+C, CTRL+V, CTRL+X, CTRL+A and CTRL+S.

Step by Step procedure for Disabling right-clicking on WordPress website using plugin

Step 1

First login your website's WordPress account.
step 1 to disable right click on wordpress website using plugin

Step 2

Once you logged in, click on the Plugins option at the left side bar.

step 2 to disable right click on wordpress website using plugin

Step 3

Then, click on Add New

step 3 to disable right click on wordpress website using plugin

Step 4

In the plugins search bar, type the search keyword as shown and then, click on search.

step 4 to disable right click on wordpress website using plugin

Step 5

Now, install and activate the plugin named WP Content Copy Protection & No Right Click.

step 5 to disable right click on wordpress website using plugin

Step 6

Once, after the successful installation of the plugin. By default without making any changes in settings, the rightclick menu and copy paste functions will be disabled.

step 6 to disable right click on wordpress website using plugin

Step 7

Now, go to plugin settings and change your custom alert message and save it. So, whenever the user tries to perform the right-clicking, this alert message will be displayed to him.

step 7 to disable right click on wordpress website using plugin

Hope all these steps, helped you for turning off the right-click in an easier way by using this awesome WordPress plugin.

Disable right clicking in WordPress website without plugin

how to disable right click on wordpress website without plugin

For technically skilled users adding an additional plugin to the website, just to disable the right click is not a good option.

As there are many disadvantages to plugins such as risk to the site's security and also, you might face several speed issues. All these plugin issues will happen if they are not coded well or bloated with a lot of unnecessary features that you actually need.

That's why we came up with a solution, where you can actually prevent right click option on every single page of your WordPress website without using a plugin to do it.

Below is the step by step methods to prevent right-clicking on any WordPress website without plugin.

Step 1

First, Sign in into your WordPress account.

step 1 to disable right click on wordpress website without plugin

Step 2

Go to appearance and then, click on Widgets.

step 2 to disable right click on wordpress website without plugin

Step 3

In the available widgets section, pick the custom HTML widget. Then, drag and place it at the footer bar.

step 3 to disable right click on wordpress website without plugin

Step 4

Now, copy and paste the below code in that custom HTML widget under the given content space.

step 4 to disable right click on wordpress website without plugin


Step 5

Then, save it off.

step 5 to disable right click on wordpress website without plugin

We have successfully added the code in the footer section of the WordPress website. We have added it to the footer section in order to avoid the issues faced in the site's page speed score or cause any render-blocking issues to your website.

So, finally this awesome code without any plugin installation protects your website's content from other users.

How to disable right click on Blogger website

how to disable right click on blogger

Are you a regular blogger and want your site to be secured from content theft? Then, knowing the exact procedure for disabling the right click menu in your blogger website is very important. So, we will be an easy method where with few easy steps, you can protect your content easily.

So, let's begin this easy method to block right-click in the Blogger website and follow the steps mentioned in below.

Step 1

First, Sign in and open your website's blogger account.

Step 2

Then, Click on Layout settings option

Step 3

After choosing it, select Add a Gadget option in that layout settings.

Step 4

Over there, you must select the HTML/JavaScript tab.

Step 5

One blank page will be opened. Now, Copy and paste the below-mentioned JavaScript codes for disabling right-clicking.


Step 6

After pasting it, just click on Save option.

That's it, now you have successfully disabled it in your blogger website. So, don't have any worries, from now onwards no other users can copy and paste your blog content.

How to disable right click on Wix website

how to disable right click on wix website

Here you will be learning how to disable right click on your Wix website ?. First, let's see Why it's important?

Nowadays due to a boom in the blogging world and increased users on the web. Few of them, will simply copy your content and paste it on their web page.

It's literally content theft of stealing and wasting the whole time that you have spent to make the masterpiece content.

So, protecting your Wix website's content is important and to block the initial easy way of copying by direction right click and text selection copy paste.

You'll need the follow the step mentioned below.

Step 1

First, Sign in and go to your Wix websites dashboard.

Step 2

Then, select the site.

Step 3

Now, Click on Settings option at left side bar.

Step 4

After that, Click on the Advanced (Custom Code).

Step 5

Now, select the Add Custom Code button.

Step 6

Then, Copy and paste the below jQuery code snippet, in the empty space that appears at first.


This code will not only disables the context menu, but it also shows the alert message.

This alert message can be customized. Write your custom message instead of the "Type your custom alert message", as shown below.

alert('Type your custom alert message')

Step 7

Now, name the custom code to anything based on your preference.

Step 8

After naming it, select all pages in the add code to pages section.

Step 9

Then, Click on apply.

Now, go to your wix website and check it. The right click will be disabled and have a good content protection to your site.

How to disable right click on Shopify website

how to disable right click on shopify

Are you a Shopify website owner? and looking towards disabling right click in your Shopify website? If so, don't worry you are at the right place.

Protecting your Shopify store against content thieves are very important. Content thieves are users who copy or duplicate your unique website text, images, and videos for their personal Shopify store.

So, we will showing you how to protect important assets of your Shopify website by disabling the right click and F12 key options.

Step 1

Open your shopify admin.

Step 2

After opening it, now click on actions and then, click on edit code.

This will take you to the theme editor, whether you can edit the theme files.

Step 3

Now, search for theme.liquid file and after that open the file.

Step 4

Finally, copy the below scripts and paste it just before </head> of your shopify website file.


Step 5

Now, save the changes.

After all the changes are saved, now refresh your Shopify website's home page and check the website. It won't allow the rightclick menu and the F12 Key will also be blocked. This is how you will block this clicking on any Shopify website. Now, your website is much secured than before.

Advantages of disabling a right click menu

advantages of disabling a right click on website
  1. Every website creation consumes lots of your time and energy and so, disabling a right-click on the website helps you to protect all your valuable contents from the site visitors.
  2. If you have a low authority site and if a high domain authority site scarps your content then google considers that their content is original and you will be affected negatively on search engine rankings. So, disabling a right-click on the Website prevents these things to happen.
  3. Protects from all types of content hackers.
  4. The alert message that is shown to users on right-click, frightens the users from stealing the content and helps to safeguard your copyrighted contents.
  5. It can also help you to prevent image hotlinking, the process of embedding your site's image on another website while they are using your server resources to display the image.
  6. Another main advantage is none of your competitors can inspect your website's source code.

Disadvantages of disabling a right click menu

disadvantages of disabling a right click on website
  1. Disabling the right-click might annoy your users and also, increase the bounce rate of your website.
  2. Any Tech-savvy users can simply bypass the no right-click script, by turning off it in their browser settings.
  3. By using the 101 keys keyboard, anyone can easily execute the right-click by just holding down the shift key and F10 key.

Why do some websites disable right click?

To get the basic level of security from the users trying to steal the content like images, text and etc., This is why few websites disable these types of clicking.

Does disabling right click Affect SEO?

No, preventing rightclick or turning off text selection does not affect your SEO or website rankings. But, it annoys a few of your visitors while they perform some good clicks and that might result in bad user experience.

Can you hide your website source code?

By turning off the context menu and blocking the F12 key on the website, will help you to hide the website's source code from other users.

How do I disable right click on my WordPress site?

You can prevent the rightclick menu using two methods either by using plugins like WP Content Copy Protection & No RightClick or for without plugin you can try adding the oncontextmenu="return false;" in the body of the web page.

What does Disabling rightclick on Website means?

Disabling rightclick on website means blocking the users from accessing the context menu of your web page (also known as shortcut, contextual or pop-up menu). With help of the context menu, users can easily copy or inspect your page source code.


Thank you for the time in reading this article. We hope this article has answered all your searchings related to How to disable right click on website ?.

Keep Your Website Safe & Happy ..!!

If you have any doubts or issues, please leave them in the comment section below.

Photo of author


My name is Midhun. I am a Full-Time Blogger and YouTuber. I love sharing my genuine reviews on Tech products, New updates on Technology, and Blogging tips and tricks. Quite interested to solve your problems with the knowledge i gained.

2 thoughts on “How to Disable Right Click on Website”

  1. I’m not that much of a internet reader to be honest but your sites really nice, keep it up! I’ll go ahead and bookmark your website to come back later on. Many thanks


Leave a Comment