Hi there, 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>
I guess you could say the script works... I don't get an error, but the body of my email message looks like this: Check out this great new feature story: http%3A//www.somesite.com/subpage.asp%3FsectionID%3D752 The above "URL" is not working in my browser. Let me know if you need anymore info and thank you for your response!
I tested the script http://localhost/TestEmail.html?show=Test Me with IE, Firefox and Opera. With IE and Firefox I got "Check out this great new feature story: http://localhost/TestEmail.html?show=Test%20Me" With Opera the body was "Check out this great new feature story: http://localhost/TestEmail.html?show=Test%20Me%0A%0A" And the links did work in all three cases. Which is your mail client?
mail client is Lotus Notes on OSX and I also tested on my other Mac, mail client Entourage on OSX... and it still comes out as http%3A//www.somesite.com/subpage.asp%3FsectionID%3D752
I'm sorry, I can't be of any help then. I have never worked on OSX. Using the mail client for sending the mail seems very unprofessional. If you have server side scripting support, google for some similar scripts in PHP or ASP. That will be much more easier for users too.
*sigh* you are right... server side it is. thank you so much for your help. I marvel at how much time you must spend on here.
I joined DP eight days back. I used to ask for help and used to study many free codes when I started programming. So I thought I should be giving something back to the webmaster community. Ofcourse, I am partcipating in the revenue sharing too . Since I joined DP, I spend atleast 8 hours a day browsing the forum.