Annoyance of the year: overriding copy/paste functionality using JavaScript

I got a bit annoyed with NoScript last week due to the continous white-listing while randomly surfing the web, so I reluctingly decided to pick the dangerous Allow Scripts Globally option. However, this has introduced me to an annoyance far greater and that is: websites overriding copy/paste functionalty using JavaScript.

Yes, this is actually possible and quite easy because all one has to do is register an event handler for the onCopy event. The sites I’ve stumbled upon so far are using it to add some text like “Read more at …”.

This is extremely annoying because it breaks my workflow in several situations, not limited to:

  • When I want to search the web using the copied text: I will first copy the text (Ctrl + C) and then paste it into the search box using (Ctrl + K and Ctrl + P) (possibly adding more search terms).
  • When I want to copy the text for use in a blog post (like this one).

If you don’t understand why this is annoying, you just don’t get it.

So for now I’ve enabled NoScript again, but as NoScript whitelists domains it means some websites might still slip through the cracks. If I get annoyed enough I might look into the possibility of removing attached event handlers using JavaScript injection (e.g. through GreaseMonkey).

One response to “Annoyance of the year: overriding copy/paste functionality using JavaScript”

Leave a Reply