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.
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.
Table of Contents
- Methods for Disabling the right-click button on a Web page
- Disable right click in HTML
- How to disable right click on Website in PHP
- Prevent right-clicking in ASP.NET
- How to disable right click on WordPress website
- How to disable right click on Blogger website
- How to disable right click on Wix website
- How to disable right click on Shopify website
- Advantages of disabling a right click menu
- Disadvantages of disabling a right click menu
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
Simply add the following programming lines in place of the default <body> tag mentioned on your HTML page.
Before adding code:
After adding code:
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.
<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.
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.
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
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
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
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.
- With Plugin
- 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.
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
First login your website's WordPress account.
Once you logged in, click on the Plugins option at the left side bar.
Then, click on Add New
In the plugins search bar, type the search keyword as shown and then, click on search.
Now, install and activate the plugin named WP Content Copy Protection & No Right Click.
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.
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.
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
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.
First, Sign in into your WordPress account.
Go to appearance and then, click on Widgets.
In the available widgets section, pick the custom HTML widget. Then, drag and place it at the footer bar.
Now, copy and paste the below code in that custom HTML widget under the given content space.
Then, save it off.
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
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.
First, Sign in and open your website's blogger account.
Then, Click on Layout settings option
After choosing it, select Add a Gadget option in that layout settings.
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
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.
First, Sign in and go to your Wix websites dashboard.
Then, select the site.
Now, Click on Settings option at left side bar.
After that, Click on the Advanced (Custom Code).
Now, select the Add Custom Code button.
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')
Now, name the custom code to anything based on your preference.
After naming it, select all pages in the add code to pages section.
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
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.
Open your shopify admin.
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.
Now, search for theme.liquid file and after that open the file.
Finally, copy the below scripts and paste it just before </head> of your shopify website file.
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
- 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.
- 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.
- Protects from all types of content hackers.
- 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.
- 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.
- Another main advantage is none of your competitors can inspect your website's source code.
Disadvantages of disabling a right click menu
- Disabling the right-click might annoy your users and also, increase the bounce rate of your website.
- Any Tech-savvy users can simply bypass the no right-click script, by turning off it in their browser settings.
- 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.