Is it possible to track the action on the site at all (copying the contents - Ctrl + C or right-click + copy) and how?

  • four
    Do, do so. This is the surest way to turn users away from your site. Remember that the average person will never copy the whole page - he does not need it, but to copy a word (for example, to translate into your language) or a link, or a quote "for a friend." What do you think, how long will the user last on the site? - KoVadim

4 answers 4

Copy the right button does not track, Ctrl + C js is caught well :) The right button can be disabled, for example:

<body oncontextmenu="return false;"> 

And you can catch Ctrl + C like this:

 var isCtrl = false; document.onkeyup=function(e){ if(e.which == 17) isCtrl=false; } document.onkeydown=function(e) { if(e.which == 17) isCtrl=true; if(e.which == 67 && isCtrl === true) { return false; } } 
  • I see. Thanks. And then how to find out the data of IP, browser, etc. (or rather, they are recorded in a file) of a person (like in Li counters). Help, thank you. - Vasya Pupkin
  • one
    Then when? :) If at the moment of pressing ctrl + c, then send an ajax request, and on the server side get remote_addr and user_agent. In general, create a new topic, and if the question is closed, then tick. - Alex Silaev
  • Why send something? At that moment, when the user began to load this page, he has already transferred everything. What else could be an AJAX request if everything has already been transferred? - cy6erGn0m
  • I still need to send the request, I understand that you need to write down who and from what ip tried to copy the text or right-click ... If you follow your advice, it turns out you need to write data somewhere (for example, in a session), but sending a request, tear them out and save where necessary. In general, as I understand it, you need it at the moment of pressing. - Alex Silaev

Disappoint, but 100% track keystrokes can not.

  • Firstly, besides Ctrl + c, there is a Ctrl + Insert combination, about which many people have already forgotten, but this does not mean that it does not work.
  • Secondly, there are programs that provide more clipboards from other buttons.
  • Thirdly, simply turning off js for the site will make copy tracking not possible.
  • Fourthly, when viewing the page code, you can easily pull out the desired text.
  • 2
    I think that the prohibition of system functions and various "copy protection" is complete nonsense and can only vybysit user, IMHO. - Alex Silaev
  • one
    + copying content by viewing the content of the page or firebug console :) - zippp
  • one
    Besides, people do not already have copy-paste ... there are parsers and grabbers for such cases .. - Yoharny Babai

In JS, there is an oncopy event that can be traced:

 document.addEventListener('copy', function(){ document.getElementById('outs').innerHTML = 'You copy the text' }); 
 <p>some text</p> <div id="outs"></div> 

    Instead of catching Ctrl + C , you can prevent text from being selected in a particular div! Here is a good little article about this!

    ZY there is no escape from shutting down JS)