How to protect website from downloading? Protect a site on bare html

Started by Fan_Tema, Aug 21, 2022, 04:34 AM

Previous topic - Next topic

Fan_TemaTopic starter

Are there any ways to protect website on bare html from downloading? HTTrack Website Copier and others like it brutally pull everything, I would like to prevent this from being done.

And there are sensible cryptographers to insert the code of the entire main page and encode it normally? How many have not tried different scripts kill.


100% - no way. Only closing from all users.
From bots - check for refer, user-agent , this will cut the bots in half.
Check headers, agent and redirect to another page.
As a "bad" option - cloudfare, hcaptcha. The percentage of users will suffer, but it will also cut more bots.

I also use text copy protection on html and bootstrap sites.
If in the body tag - write the following <body oncopy="return false;">

Then when copying with the mouse or ctr + C. Nothing will happen.
Many will not bother and will leave to look for other sources.


Oh, those copywriters. I also analyzed my site through Net and I found hundreds of copies of my articles, it's a shame how awful.
And the script was adding a link when copying, only zero sense. I noticed that they do not copy from the page itself, but the HTML code.
I tried to put the code you provided, you really won't copy and highlight it, but if you press ctrl+u, the page code opens again.

I am especially not happy about their theft by the fact that my website has dropped out of the index several times for technical reasons, and the websites are now the primary sources.

Copy Protection script.
In general, in order to somehow protect the content from the usual schoolboy, I Googled and found a script that prohibits text selection and copying.
The script is inserted between the Head tags.
You can put it in a separate JS file, and specify the storage path on the hosting.


 function preventSelection(element){
 var preventSelection = false;

 function addHandler(element, event, handler){
 if (element.attachEvent)
 element.attachEvent('on' + event, handler);
 if (element.addEventListener)
 element.addEventListener(event, handler, false);
 function removeSelection(){
 if (window.getSelection) { window.getSelection().removeAllRanges(); }
 else if (document.selection && document.selection.clear)
 function killCtrlA(event){
 var event = event || window.event;
 var sender = || event.srcElement;
 if (sender.tagName.match(/INPUT|TEXTAREA/i))
 var key = event.keyCode || event.which;
 if (event.ctrlKey && key == 'A'.charCodeAt(0))
 if (event.preventDefault)
 event.returnValue = false;
 addHandler(element, 'mousemove', function(){
 addHandler(element, 'mousedown', function(event){
 var event = event || window.event;
 var sender = || event.srcElement;
 preventSelection = !sender.tagName.match(/INPUT|TEXTAREA/i);
 addHandler(element, 'mouseup', function(){
 if (preventSelection)
 preventSelection = false;
 addHandler(element, 'keydown', killCtrlA);
 addHandler(element, 'keyup', killCtrlA);
 document.ondragstart = test;
 document.onselectstart = test;
 document.oncontextmenu = test;
 function test() {
 return false

It is clear that from the pros who use special software and rivet hundreds of shitsites, this will not save, but at least complicate the life of "beginners".


HTML was originally created as a completely open standard. Therefore, it was not originally intended to hide it from strangers who like to get on the buttons Ctrl + C. Information security experts I know told me over tea that viewing html code is not a crime.
You can use the methodology of executing code on the server, and give only the result to the browser. Sometimes this is useful.