[WEB4LIB] Automatically adding URL/TITLE to mailto link

Michael Sauers msauers at bcr.org
Thu Aug 19 12:56:28 EDT 1999


> Short of
> actually putting that information in each mailto link as a
> subject, is there
> an automatic way I can do this?  Maybe it would grab the URL or
> title of the
> page and place it in the subject or message body.

Can be done with JavaScript:

1	<SCRIPT language="javascript">
2	<!--
3	function SendEMail()
4	{
5		var sRef = "mailto:&subject=THIS IS THE SUBJECT&
6	body=THIS APPEARS IN THE BODY " + location.href;
7		location.href = sRef;
8	}
9	//-->
10	</SCRIPT>
11
12	<A href="Javascript:SendEMail();">
13	Send this link to a friend.</A>

Lines 1-10 go in the head of your document.

Lines 5 & 6 must be typed in as one line without line breaks or word
wrapping.

Replace THIS IS THE SUBJECT with the text you want to appear in the subject
line.

Replace THIS APPEARS IN THE BODY with the text you want to appear in the
body of the message, to be followed by the URL and title of the document.

Line 12 goes in the body of the document where you want the link to appear.

You may replace SEND THIS LINK TO A FRIEND with your own text.

--------------------------------------------------------
Michael Sauers, Internet Trainer
Bibliographical Center for Research (BCR)
Aurora, CO :: msauers at bcr.org
http://www.bcr.org/~msauers
The WWW Library Directory is @
http://www.webpan.com/msauers/libdir/
Opinions expressed are my own unless otherwise noted.
---------------------------------------------------------



More information about the Web4lib mailing list