Yesterday I had a chat with a taxi driver and upon mentioning that I am a programmer, he told me that a couple of days earlier he had experienced the following: upon trying to copy the URL from the address bar of his browser, a messagebox appeared with a message like "Please don't copy this link, rather register".
I am not a web developer, so this might be a lame question :-) but I wonder how such a thing is accomplished? What technology or language gives one this level of control over the events within the browser?
The site was some sort of a movie downloading service, as far as I understood. I failed to ask him what browser he used, but his platform was WinXP so most probably it was IE. Since I have no idea of the technology implementing this feature, I can't add any technology specific tags, but if you know an appropriate one, feel free to add it.
Upon reading the answers, most seem to converge on the opinion that
I specifically asked back to make sure that he meant he was copying the URL from the address bar, and he confirmed that. Nevertheless, it might still be a misunderstanding on either side. I haven't seen the event happening, so I can only repeat its description as I heard it.
There are a few ways a website can track whether someone is copying and pasting text. One way is to use a plugin that tracks this activity. This plugin can track attempts to copy text and images from the website, or disable the corresponding functions altogether.
In the right-click menu that appears choose the right-click, Copy link address, or Copy link location option (varies by browser). Once done that address is copied into your clipboard and can be pasted into e-mail, document, spreadsheet, notepad, or any other file or web page.
For one, there is the rightclick
event. This is easy to catch and react on.
There also is the more general contextmenu
event, but it does not apply to browsers other than IE.
I guess that they simply prevented the right click on links, based on the assumption that no-one right-clicks on a link for any other reason than copying it. So he did not even get as far as selecting "copy link" from the context menu, the message just appeared immediately.
There are keyboard-based methods of opening the context menu, and I expect they still would have worked.
The simplest jQuery implementation of this behavior is a three-liner:
$("a").rightclick(function () {
alert("Please don't copy our links!"); return false;
});
As for "preventing copy from the address bar" - no way. They could not possibly have done this.
Address bar - no, not possible, if a browser allowed a page to intercept the addressbar then it would raise a lot of security issues.
It was most likely the page either preventing a right click on a link, or doing CTRL+C within the page itself.
If it was IE, then there's the possibility that they unwittingly installed an ActiveX control when visiting the site, which may have prevented them from copying a link from the address bar.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With