Skip to main content

email a friend scrpt not working with dynamically generated url containing special characters & combination of escaped & unescap

No replies
Joined: 2012-08-24
Points: 0

I'm trying to get a "tell a friend" script to run on my checkout page. The page URL is dynamically generated by paypal. It has special characters that foul up the script and truncate the URL.

I want to find a script/fix this script so that it will work using users' native email clients. I have a fair amount of web know-how but no formal training and it seems to me that the URL has to be escaped but the problem is the url contains partially escaped code.

Download the following pages: and

You'll see about 3 or 4 different tell-a-friend scripts on that page, all being tested. The one I'm most concerned with is the regular text hyperlink "click here" to email this page. That's the one I want to work. The others are just too complicated and have too many steps and will be eliminated. You'll notice if you test that referral hyperlink that the emailed version appears to work at first but in fact it leaves the "item selected" text area blank, which is a deal-breaker, since when a subsequent purchase or referral is made, the vital information I need to fill the order is left out.

In case of confusion, the portion of the script that controls the hyperlink is in the head of the ordering2 page and it is as follows:

<script language="javascript"> function mailpage() { mail_str = "mailto:?subject=Check out this photo: " + document.title; mail_str += "&body=I thought you might be interested in the overhead photo of the lake " + document.title; mail_str += ". You can view it at, " + location.href; location.href = mail_str; } </script>

Finally, the main thing is not that the item-selected passthrough data be identical to what it starts out being, but rather, that it be somehow recognizable. So if by escaping it a second time it appears to become gobbledeegook, I don't really care as long as I can tell what it is. That's why there are all plus signs in it in the first place.