homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

Attach current url of the page with mailto() tag

10+ Year Member

Msg#: 8910 posted 6:20 pm on Oct 20, 2004 (gmt 0)

Greetings all,

I've been trying to solve a problem I have with attaching the url of a current page into the body of an e-mail.

I wish to trigger the mail program (default) with the mailto tag when a user is sending the page to a friend.

It would look something like this I think:

<a href="mailto:someone@somedomain.com?subject=my%20subject&body=http://the url of this page">mail this link to a friend</a>

I appreciate any suggestions
thx zr



WebmasterWorld Senior Member 10+ Year Member

Msg#: 8910 posted 8:58 pm on Oct 20, 2004 (gmt 0)


<a href="mailto:someone@somedomain.com?subject=my%20subject&body=http://mydomain.com/thispage.html">mail this link to a friend</a>


<script ... >
document.write('<a href="mailto:someone@somedomain.com?subject=my%20subject&body='+top.location.href+'">mail this link to a friend</a>');


<a href="mailto:someone@somedomain.com?subject=my%20subject&body=http://<?=$HTTP_HOST.$PHP_SELF?>">mail this link to a friend</a>


WebmasterWorld Senior Member tedster us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 8910 posted 11:13 pm on Oct 20, 2004 (gmt 0)

You need to grab the url of the current page with Javascript on the client-side or a server-side script of some kind. Either that, or hand code it into each page. Then there is also the issue of how the recipient's email address gets into the mesaage and whether you want a record of that or not.

Because there is no pure HTML solution, I'd suggest working out this issue in our Javascript forum, or our either one of our PHP forum / Perl CGI script forums for a server side answer.

Also, there are many free scripts available around the web to help you do this - so you don't need to start from scratch. Try a Google search on email friend script or a related search phrase that includes the scripting technology you want to use.


10+ Year Member

Msg#: 8910 posted 11:12 am on Oct 21, 2004 (gmt 0)

Thanks guys,

I'll try it and come back to you..!


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved