Sunday, November 17, 2019

browser - How can I stop JavaScript from modifying the clipboard?


More and more I find that when I copy text from a news site, the site adds in its own advertising/footnote link to my clipboard, so that when I paste, the copied text is appended with something like:



[Text I copied] FOR MORE, GO READ AT http://www.example.com/link/to/story



I admire the technical abilities that made this possible, but I would like to stop it on my browser. I looked through about:config for "clipboard" and "copy," but the only setting I found was autocopy on highlight.


Is there a good way to stop this so that when I copy I get only the text I highlighted, relying only on Firefox's built-in copy feature and not triggering anybody's JavaScript or other site customizations? I don't like sites telling my browser how to work.


As an example, copy one of the fun "facts" here - when you paste, you'll have the following text appended:



Read more: http://www.linuxscrew.com/2007/10/28/fun-chuck-norris-vs-linus-torvalds/#ixzz1mUKtACkt



They aren't just hijacking the control-C keystroke, I get it when I select "copy" from the right click menu, as well.


I would like my browser to completely ignore this trick.


I replicated this on Firefox, IE, and Google Chrome.


Answer



It turns out this JavaScript code is being served by a "service" called tynt.com. Redirecting tcr.tynt.com to 127.0.0.1 in my hosts file solved the problem for me. From what I read elsewhere, there may be multiple servers that need to be blocked. Adblock list subscriptions may also take care of the problem, and you may be able to set up a filter in your ad blocking software to correct it.


What I would really like would be a flag in about:config to remove permission for JavaScript to modify the clipboard.


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...