What song.com developers have done is attach events to document.body.oncontextmenu
, document.onselectstart
and document.body.onkeydown
to disable browser actions.
This can be done in the same way as
<body oncontextmenu="return false" onselectstart="return false" onkeydown="if ((arguments[0] || window.event).ctrlKey) return false">
You will need all three; oncontextmenu
mainly controls right-clicks, onselectstart
covers mouse-dragging and onkeydown
Ctrl-key event (for example, the one who hit Ctrl + A , Ctrl + C to copy the entire page).
But I highly recommend you DO NOT DO IT. . It kills usability and upsets even legitimate users (for example, people who have certain key mappings, or those who use "back" and "back", reload "from the context menu), and those that you have to worry about, they wonβt interfere with even the smallest bit, and frankly, your content is not as special as you think, or you wonβt serve it to any loser using a web browser. Information that is valuable is not posted on the Internet.
As noted earlier, everything that return false
cannot be executed. And since I found the page to be particularly annoying, it prompted me to open the console and analyze what they did and separate the event handlers so that I could copy whatever I like and they donβt even get their precious click tracking data. In fact, all you have to do is disable JavaScript.
The only way to keep people from copying text from the Internet is to disconnect it from the Internet. Any other method is doomed to failure, because you yourself give them a copy as part of the action itself, serving them for them.
source share