views:

64

answers:

0

Some websites now use a javascript service from Tynt that appends text to copied content.

If you copy text from a site using this and then paste you get a link to the original content at the bottom of the text.

Tynt also tracks this as it happens. It's a neat trick well done.

Their script for doing this is impressive - rather than try to manipulate the clipboard (which only older versions of IE lets them do by default and which should always be turned off) they manipulate the actual selection.

So when you select a block of text the extra content is added as a hidden <div> included in your selection. When you paste the extra style is ignored and the extra link appears.

This is actually fairly easy to do with simple blocks of text, but a nightmare when you consider all the selections possible across complex HTML in different browsers.

I'm developing a web application - I don't want anyone to be able to track the content copied and I would like the extra info to contain something contextual, rather than just a link. Tynt's service isn't really appropriate in this case.

Does anyone know of an open source javascript library (maybe a jQuery plug in or similar) that provides similar functionality but that doesn't expose internal application data?