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.

<!doctype HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>


<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+"

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

// set up event handler
document.onmouseup = showSelection
<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; }


<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>
<p><textarea name=“selectText” rows=“12” cols=“80”></textarea> </p>



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!