Cross Browser Tell a Friend JavaScript
Posted By tomcanji on April 8, 2009
Recently we had a client asking for a “tell a friend” JavaScript that works in all major web browsers.
Why not - how complicate can it be? All I have to do is type something like this in google and I’ll have my “Tell a Friend” working on ie, ie6, firefox, safari in no time… Yeah right.
As you’ve might of guessed that was not the case.
Finally we found something that works so here it is
Copy the js code blelow
var SubjectLine='Take a look at this web page I found, '+top.document.title;
var BodyText='You can see this page at: '+top.location.href;
var Message='Send <A CLASS=contact HREF="mailto:?SUBJECT='+escape(SubjectLine)+'&BODY='+escape(BodyText)+'" TITLE="Send your friends e-mail about this page">this page<\/A> to a friend.';
var MessageIE='Send <A CLASS=contact HREF="mailto:?SUBJECT='+(SubjectLine)+'&BODY='+(BodyText)+'" TITLE="Send your friends e-mail about this page">this page<\/A> to a friend.';
if(document.all) { document.write(MessageIE); }
else { document.write(Message); }
</SCRIPT>
paste this code on the place you want your “Tell a Friend” link to appear
Comments
Dusan Belic says:
tomcanji says:
slim says:
ads says:
dsx says:
6 Responses to “Cross Browser Tell a Friend JavaScript”
April 9th, 2009 at 12:27 am
Heh. Kad predjes misem preko linka u statusbar-u pise na francuskom, a title (kad malo duze drzis mis na linku) je na engleskom. Ovo je ujedno alatka za ucenje jezika.
April 10th, 2009 at 12:23 pm
Hi Dusan, thanks for noticing
I have fixed this issue. There have also been some bugs concerning the title of “tell a freind” email - this has also been fixed.
June 14th, 2009 at 9:50 pm
bro wat sapp… i want 2 ask u bout disable ctrl + a,c,j,n for ie can work but not realy work in fire fox how.??/ email me.. shahril143@gmail.com
November 14th, 2009 at 9:44 am
asdas
November 14th, 2009 at 9:45 am
dsa