I am developing a website for an organization. They asked me to limit copying website contents to 300 words. i've googled, but i couldn't found any sollutions.. if there any scripts(javaScript or PHP) to do this?
Asked
Active
Viewed 177 times
-1
-
Could you clarify what you mean by `limit copying website contents to 300 words`. – Musa Oct 10 '12 at 06:01
-
do you mean that users should only be able to select 300 words at maximum to copy? – philipp Oct 10 '12 at 06:01
-
Are you talking about truncating any content to 300 characters? – shapeshifter Oct 10 '12 at 06:01
-
yep . . . they asked me to limit the user, to copy only 300 words on a page. – Charman Oct 10 '12 at 06:03
-
could you tell what is the mean of copy only 300 character from page – NullPoiиteя Oct 10 '12 at 06:05
-
5That's impossible. You can't stop or limit people from copying a website's content, no matter what you throw at them. – NullUserException Oct 10 '12 at 06:06
-
**Such measures can be circumvented easily by going to the HTML source. And no, obfuscation of it is not a solution.** | @NullUserException: It *is* possible to modify what's copied to the clipboard when using CTRL+C. I've seen it happen myself. See http://stackoverflow.com/questions/1203082/injecting-text-when-content-is-copied-from-web-page for a possible solution; basically using the [tynt.com](http://www.tynt.com/) service is probably the easiest solution. Not sure if you can actually *limit* the copied contents thoug instead of just adding e.g. a link. – ThiefMaster Oct 10 '12 at 06:07
-
@NullUserException It's definitely possible through programming means... But that can as ThiefMaster mentioned all can be circumvented by viewing the page source – tomaroo Oct 10 '12 at 06:09
-
for an example...say there is a paragraph containing around 500 words. When a user try to copy that paragraph...the page should allow only upto 300 words (maximum) for that user to copy and prompt an alert when he try to copy more than 300 words. Is it possible to restrict the amount being copied? – Charman Oct 10 '12 at 06:09
-
@ThiefMaster Yes, I've seen it happen to me too and I had tons of pages to copy. I simply used an HTTP sniffer, and programmatically parsed the files. I had just started programming; if I were to do it now, I would probably automate the whole scraping process. To the OP: yes, there are many ways to annoy and slow down the user, but you can't stop them. – NullUserException Oct 10 '12 at 06:10
-
@ThiefMaster: But one can simply save the whole document in that case. If the content is mostly generated by javascript one can still print to PDF and copy from there. These are simple laymen ways to get around it. As a developer I'd simply use firebug and export the whole DOM tree. – slebetman Oct 10 '12 at 06:11
-
1Usually this kind of stuff is meant to affect that the average non-tech-savvy user can do. The kind of user who just surfs the web and plays Farmville. – ThiefMaster Oct 10 '12 at 06:13
-
All the user needs is HTTrack. It is very easy to use, the only reason people still dream to reduce the hability of the user to copy web content is the fact this kind of tools aren't well known. Now, if that organization insists in restricting their users, aren't they going to reduce their popularity? – Theraot Oct 10 '12 at 06:25
2 Answers
1
you can not stop user to copy the website content .. even if you try to do this by javascript there are many tools like firebug by which user can get the data

NullPoiиteя
- 56,591
- 22
- 125
- 143
-
Yes, for those who **really** want to get the content, they can. But you can certainly make it a **pain** for the average user to accomplish this. While objectively true, I don't think this answer is constructive. – tomaroo Oct 10 '12 at 06:20
-
1@tomaroo: Thanx for your information. I think it would be use full for my project. – Charman Oct 10 '12 at 08:06
1
Disabling right click on the website is the usual mechanism to stop people from directly copying the contents. If you do want to impose a 300 character allowance you will have to to listen to text selection events and once the user has reached max chars limit you prevent him from proceeding further. A quick google search on js snippets for selecting text presented the following two links:

Ifthikhan
- 1,484
- 10
- 14