Forum Moderators: open
I'm using the javascript tell a friend script below, and since my dynamic URL was being truncated because of the &, I use the javascript escape function to change all special characters to their hex code equivalents.
Now my URL that I want to send to a friend appears in the email to them with all of the escape characters. Firstly, it will look weird to whoever I send it to, but also when I copy and paste the hex encoded URL into my browser, it doesn't work.
Does anyone know why that is, or what I am doing wrong?
<FORM name='email_friend_script'>
<TABLE>
<TR>
<TD><INPUT type='text' name='address' size='25' maxsize='128'></TD>
<TD><INPUT type='image' src='/images/temp/tell_a_friend.gif' onClick='jsMailThisUrl();'></TD>
</TR>
</TABLE>
</FORM>
<SCRIPT language='javascript'>
<!--
function jsMailThisUrl()
{
var email_subject = 'Check out this web page I found...';
var email_body = 'Check out this great new feature story: ';
//var page_url = window.self.location.href.split( '?' )[0];
var page_url=window.location.href;
//page_url = page_url + '';
page_url = escape(page_url);
var field = document.email_friend_script.address;
window.location = 'mailto:' + field.value + '?subject=' +
escape( email_subject ) + '&body=' +
escape( email_body + page_url +'\n\n');
}
//-->
</SCRIPT>