Preventing text to be copied from a website has been around for ages. The onCopy method gives us a handler just before content is copied allowing the actual copied text to be manipulated. The tynt site requires us to insert a script that registers handlers. Here is the step by step explanation, once their script loads on our website.
- Register handlers for onCopy, onDrag, etc on the window Object
- Get a unique URL that will be used as a tracker
- When any of the registered event occurs
- Send an event to the server
- On firefox, create a new node with the data that has to be displayed with the content that is copied. Set selection to existing node and this new node.
- On IE, add extra text to the current Selection
- Cancel the propagation of the current event.
As for how the analysis was done, all I had to do was use Fiddler to load a formatted version of Tracer.js?user= to understand the code. Then I had to check out the eventHandlers that led me to handleTracing(). The function has a could of inline functions and one of them, called H() is responsible for replacing the text.