Embed Site URL when copying Web Page Content

Hi. I’ve seen this trick on a couple of sites. I’m guessing it’s using Javascript.

Go to the link below. Copy some text on the page. Then paste into word or somewhere. It will paste the text you copied, and a “Read more:” along with the URL from that page. Very nifty. I looked at the code, and the page is an absolute mess. Anybody know which script can do this? thanks.

I don’t see what you’re talking about. I went there and nothing like you described happened.

A Win/I.E. only thing?

This script makes use of the selection object to add a message to selected text. I have dumped the result in this example into an on-page textarea, but you can change the script to meet your own needs.

[HIGHLIGHT=“”]
<!doctype HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>

<head>

<title>Getting Selected Text</title>
<script type=“text/javascript”>
<!–
// this is the added message
var addMsg=‘For more information: <a href=“http://www.smh.com.au”>SMH</a>’;
//
// this fires on mouseup after seletion
function showSelection()
{ if (document.selection) // IE
{ document.forms[0].selectText.value=document.selection.createRange().text+"

“+addMsg;
event.cancelBubble = true;
}
else if (window.getSelection || document.getSelection) // not IE, includes Mac
{ document.forms[0].selectText.value = window.getSelection()+”

"+addMsg;
}
}
//
// set up event handler
document.onmouseup = showSelection
//–>
</script>
<style type=“text/css”>
<!–
body { font-family:arial, helvetica, sans-serif; color:#000; font-size:13px; font-weight:normal; }
p { margin-top:0px; margin-bottom:5px; }
form { margin-top:20px; }
textarea { font-weight:bold; color:#000080; }
.aBld { font-weight:bold; margin-top:20px; }
–>
</style>
</head>

<body>

<p class=“aBld”>Select some text anywhere on this page to capture the selection
and add a message:</p>
<h2>This is a header</h2>
<p>Veni Karthaginem, et circumstrepebat me undique sartago flagitiosorum amorum.
nondum amabam.</p>
<p>Amare amabam, et secretiore indigentia oderam me minus indigentem. quaerebam
quid amarem, amans amare, et oderam securitatem et viam sine muscipulis.</p>
<p>Quoniam fames mihi erat intus ab interiore cibo, te ipso, deus meus, et ea
fame non esuriebam</p>
</hr>
<form>
<p><textarea name=“selectText” rows=“12” cols=“80”></textarea> </p>
</form>

</body>

</html>

AllanP > looks good. not quite was I was looking for, but nifty. The page, and other pages I’ve seen like this, are simialar. put it does what you did in the clipboard, then when i paste, it pastes the message along with it. thanks!