View Full Version : "Read More..."

Arty Ziff
11-17-2010, 06:39 AM
There are a growing number of web sites that have a "feature" (if you want to call it that) where when you high-lite and copy some text, when you paste the text there is an additional few lines like "Read more at http://www.blawblawblaw.com/some/linky"

Time.com is such a site. For example, copied from the front page:
The woman who could be the next President of Haiti and the first female to be elected to that office doesn't strike you as an insurgent when she walks into a room.

Read more: http://www.time.com/time/world/article/0,8599,2031412,00.html#ixzz15QHfMbRg
The part I high-lited and copied did not include the "Read more..."

I assume this is done with JavaScript, but I couldn't find the code in the source (it's probably deep in some linked library). I'm thinking of maybe starting with one of those functions that disables copy/paste/context menu, and modding it.

Any idea how this is done?

11-17-2010, 04:25 PM
Your example provided looks to me to be a simple HTML link with a 'Read more: ' prefix.

What else do you want it to do?

Old Pedant
11-17-2010, 11:53 PM
No, jmrker, I've seen this before.

They do it no matter *what* text on the page you highlight. When you click COPY (or equivalent), they indeed append a copyright message or a read more or a "copied from xxx.com" or whatever.

It's not too hard. You just have to intercept the copy function. I think you can actually do it based on the selection property. I remember looking at the code that did it maybe 18 months or so ago.

Oh, w.t.h.... Let me go look at the site he referenced...

Old Pedant
11-18-2010, 12:11 AM
Yeah, I thought so...it doesn't happen in Firefox. So they are indeed taking advantage of MSIE's selection process.

11-18-2010, 12:16 AM
Yeah, I thought so...it doesn't happen in Firefox. So they are indeed taking advantage of MSIE's selection process.It does work in Firefox, on Linux even, I just had to try it. It seems you have to enable popups for it to work, so maybe it's meant to be a popup on select, or some such. When I pasted the select/copy into a document it hat the read more.

Old Pedant
11-18-2010, 12:33 AM
Yeah, got it to work in FF without enabling popups.

I poked around with Firebug but there is so much utter crap on that page that it's hard to know what is doing what.

Find another, simpler, page that does it and I think we could find the code.

Pretty sure it will be tied to the onselect or more likely oncopy event. And then selection will find what is selected.

Old Pedant
11-18-2010, 12:34 AM
Here are MSIE docs on this:

Arty Ziff
11-18-2010, 01:56 AM
Works on any browser. Checked it on IE/Chrome/FF on WinXP.