There’s been an increase in content and image theft as a result of the influx of new bloggers. For that reason, many people look for ways to protect their contents.
How to Disable Right Click Using CSS
You can find the texts content of most web pages in the <body> tag. So when the CSS script is added to your site’s CSS file, your content would automatically be protected.
Well, if you would want to disable right click completely on your website, then you would have to use additional methods. A combination of CSS code and other codes would provide an enhanced content protection.
Here is the CSS code to disable to right click:
-webkit-user-select: none; /* Chrome all / Safari all */
-moz-user-select: none; /* Firefox all */
-ms-user-select: none; /* IE 10+ */
You should include CSS snippet to your website CSS file. If you look at it carefully, the code above is for the <body> tag. After including the code, you can test your site and see if you would be able to copy with a right click.
How to Disable Right Click Using HTML Body Tag
The use of HTML <body> tag is another way that you can disable right click on your website. If you designed your web pages with a tool like Elementor, you can use it to add the oncontextmenu handler to your website.
With the use of a page builder, it is very easy to use HTML to protect your contents. You simply have to search for <body> on your web page and locate the source code of your site. Then modify the <body> tag.
Edit <body> to <body oncontextmenu=”return false;” >
It is quite easy to do this modification. Take a look at the code above, we simply added the oncontextmenu handler. That would help to disable right click and protect your content.
Add this HTML code to the <head> tag of your website:
document.addEventListener('contextmenu', event => event.preventDefault());
How to Disable Right Click on WordPress
If you are using WordPress, there are several plugins to disable right click. You can install WP Copyright protection or Prevent Content Theft [Disable Right Click] by Shrinivas Naik.
Or you could click the “Add New” button on your WordPress plugin area and search for content protection protect, you would find some other effective plugins. Ensure to read the reviews before you install any plugin on WordPress. There’s no guarantee that a plugin that worked last year would still be working.
The Bottom Line
But for others, sadly there is nothing you can do. You content is usually downloaded to a browser, to a user can modify the browser to view your content the way he chooses.
If you really care about content protection, then you can make your website DCMA compliant. If you have any issue with anyone, you can then file a DCMA report.
The use of the methods in this article may be unlawful in some regions. When right click is disabled, it makes it difficult for visually impaired and elderly people to access your contents.
It is a form of discrimination against these individuals. So if in your region, using such content protection violates any rule, we would advice against so. You don’t want any legal complaint, right? Ofcourse not.
Zerofy Editorial is a team of writers determined to provide evergreen content to millions of readers worldwide.