Prevent Right-Clicking on a Site

I noticed some people are asking about blocking right-click access on their sites. I'll share a simple code for this, but I want to provide some information. If you're doing this out of fear of content theft, someone with little knowledge in these matters will be able to access any of your content. The page source files are eventually accessible. Let's move on to our code. Add the following script code to your site.

document.addEventListener("contextmenu", function(e){ e.preventDefault(); }, false);
0 0 votes
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments