And so, as you already understood from the title of the article, today we will talk a little about how to protect your text from theft. Kopipast in our time, the phenomenon is very common, and very often it happens that you suffered, wrote unique article for your site, or ordered its writing from people who are engaged in writing an article, and after your text from the site meets on other third-party resources, and it's very annoying.
That's it this sore topic I want to spend a few minutes of my time. Below we learn how to protect the content of your site from copying using various options for protecting content.
Of course, I want to note that I do not have a 100% effective method of copying texts from your site, but we can make copying from the site more difficult and inconvenient, and if the copier is not convenient, he will throw this venture and go to someone else that would steal the text from him.
There are many different ways to protect text on the site from copying, but today I will describe here the most basic ones that I often use myself at development of sites.
And so, protection from copying content, where to start?
1. Consider the first option - add your text to the copied content from your site.
That is, in this example, we will not prohibit copying, but only add our hidden link to the copied text from our site. If a person copies something from the site and tries to paste it onto his site, below your copied text, your text or link will be displayed.
For example, it will look like this: "The original article is here https://web-ukraine.com", of course, he can also delete this text and then only hope that he has at least a drop of conscience ...
And so in order to protect your content by adding a link to your site, do the following:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<script type="text/javascript"> function addLink() { var body_element = document.getElementsByTagName('body')[0]; var selection; selection = window.getSelection(); var pagelink = "The original article is here: <a href='"+document.location.href+"'>"+document.location.href+"</a>Β© web-ukraine.com"; // Here you can specify what exactly will be added when copying var copytext = selection + pagelink; var newdiv = document.createElement('div'); newdiv.style.position='absolute'; newdiv.style.left='-99999px'; body_element.appendChild(newdiv); newdiv.innerHTML = copytext; selection.selectAllChildren(newdiv); window.setTimeout(function() { body_element.removeChild(newdiv); },0); } document.oncopy = addLink; </script> |
This script you need to place on all pages of your site somewhere above theΒ </head>, tag, I recommend inserting it immediately above this tag.
As you can see in the script the text and address of the site is specified, you can specify your text and of course your site, the link to your site will remain clickable when copying.
2. Now let's look at the second optionΒ protect the site from copying text.
The script below will disallow the selection of text on the site, that it will not be possible to copy it, but at the same time we leave the right mouse button working.
This method is good because the average user will not feel inconvenience when visiting your site, and someone who wants to steal your text you will ask some inconvenience.
As we said before, you can not completely prohibit copying your text, you can copy it for example by opening the source code of the page, but there is an HTML markup in the text that you will need to clean before inserting it, and all this takes, so not every amateur copywriter will want to steal your text as it will simply not be convenient for him.
And so to use this version of content protection on the site, paste this code:
1 2 3 4 |
<script language="JavaScript"> document.onselectstart=function(){return false} document.onmousedown=function(){return false} </script> |
This code, as well as in the first version, is inserted somewhere above theΒ </head> tag.
3. Now let's look at another way protect the text on the site from being copied.
This variant of text protection will duplicate the above described method, but plus it will also add a ban on the functioning of the right mouse button on your site. That is, a person visiting your site will not be able to select text and will not be able to work with the right mouse button.
To use this third method of content protection on your site, add the same before the tag Β </head> code is shown below:
1 2 3 4 5 |
<script language="JavaScript"> document.onselectstart=function(){return false} document.oncontextmenu=function(){return false} document.onmousedown=function(){return false} </script> |
That's basically all the basic options that I wanted to recommend to you. There are a lot of other solutions on the web, but which one to use for you.
For example, when developing sites I try not to use anything that can somehow make the site for the visitor uncomfortable, and I always make sure that every published article was first indexed by search engines on my site.
That is, I manually send each new page to the robots, and if the robot first sees this content on my site, then all the others will automatically be considered a copy-paste, that is not unique content.
General try, if that is not clear comment. You know the best solution for this problem in your opinion, write in the comments.
No Comment
You can post first response comment.