469,573 Members | 1,646 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,573 developers. It's quick & easy.

Mailto question

Joh
I'm using mailto to open up an email that have a hyperlink in the body.
The hyperlink passes two variables Name and Emailadress. The problem is
that only the first variable Name show up in the hyperlink. It seems
that javascript takes the & as the end of the body where I use it to
separate my variables. Anyone know how to deal with this?

"<script
language='javascript'>window.open('mailto:&body=ht tp://www.abc.com/te********************************@abc.com',
'_blank');</script>"

Dec 16 '06 #1
5 5373
Joh wrote:
I'm using mailto to open up an email that have a hyperlink in the body.
The hyperlink passes two variables Name and Emailadress. The problem is
that only the first variable Name show up in the hyperlink. It seems
that javascript takes the & as the end of the body where I use it to
separate my variables. Anyone know how to deal with this?

"<script
language='javascript'>window.open('mailto:&body=ht tp://www.abc.com/te********************************@abc.com',
'_blank');</script>"
mailto://ab*@abc.com?body=http://www.abc.com/test.aspx&Name=abc&subject=a
subject!

You didn't ask for it, but I added in a subject too, you can delete it
(&subject...) if you decide not to use it.

Hope that helps you out a bit.

--
http://www.hunlock.com -- Musings in Javascript, CSS.
$FA
Dec 16 '06 #2
Joh

pcx99 skrev:
Joh wrote:
I'm using mailto to open up an email that have a hyperlink in the body.
The hyperlink passes two variables Name and Emailadress. The problem is
that only the first variable Name show up in the hyperlink. It seems
that javascript takes the & as the end of the body where I use it to
separate my variables. Anyone know how to deal with this?

"<script
language='javascript'>window.open('mailto:&body=ht tp://www.abc.com/test.aspx?Var1=abc&Var2=123,
'_blank');</script>"

mailto://ab*@abc.com?body=http://www.abc.com/test.aspx&Name=abc&subject=a
subject!

You didn't ask for it, but I added in a subject too, you can delete it
(&subject...) if you decide not to use it.

Hope that helps you out a bit.

--
http://www.hunlock.com -- Musings in Javascript, CSS.
$FA
Thanks pcx99 for your response but it doesn't answer my question. My
problem is that when I try to pass on two variables Var1 and Var2 with
a hyperlink inside an email that I open with mailto only the first
variable Var1 show up in the hyperlink. It seams that javascript takes
& as the end of the email body where I want to use it to separate my
two varables that are passed on with the hyperlink.

Dec 16 '06 #3
Joh

Joh skrev:
pcx99 skrev:
Joh wrote:
I'm using mailto to open up an email that have a hyperlink in the body.
The hyperlink passes two variables Name and Emailadress. The problem is
that only the first variable Name show up in the hyperlink. It seems
that javascript takes the & as the end of the body where I use it to
separate my variables. Anyone know how to deal with this?
>
"<script
language='javascript'>window.open('mailto:&body=ht tp://www.abc.com/test.aspx?Var1=abc&Var2=123,
'_blank');</script>"
>
mailto://ab*@abc.com?body=http://www.abc.com/test.aspx&Name=abc&subject=a
subject!

You didn't ask for it, but I added in a subject too, you can delete it
(&subject...) if you decide not to use it.

Hope that helps you out a bit.

--
http://www.hunlock.com -- Musings in Javascript, CSS.
$FA
Thanks pcx99 for your response but it doesn't answer my question. My
problem is that when I try to pass on two variables Var1 and Var2 with
a hyperlink inside an email that I open with mailto only the first
variable Var1 show up in the hyperlink. It seams that javascript takes
& as the end of the email body where I want to use it to separate my
two varables that are passed on with the hyperlink.

Thanks pcx99 for your response but it doesn't answer my question. My
problem is that when I try to pass on two variables Var1 and Var2 with
a hyperlink inside an email that I open with mailto only the first
variable Var1 show up in the hyperlink. It seams that javascript takes
& as the end of the email body where I want to use it to separate my
two varables that are passed on with the hyperlink.

"<script
language='javascript'>window.open('mailto:&body=ht tp://www.abc.com/test.aspx?Var1=abc&Var2=123,
'_blank');</script>"

Dec 16 '06 #4
Joh wrote:
Thanks pcx99 for your response but it doesn't answer my question. My
problem is that when I try to pass on two variables Var1 and Var2 with
a hyperlink inside an email that I open with mailto only the first
variable Var1 show up in the hyperlink. It seams that javascript takes
& as the end of the email body where I want to use it to separate my
two varables that are passed on with the hyperlink.

Ah, that's because the & in the url is getting mixed up with the mailto
address. Basically mailto is using & to separate data and the url you
have for the body is also using & to separate its data. So the solution
is to escape the data like this...

<script language='javascript'>

window.open('mailto:abc.com?body='+escape('http://www.abc.com/test.aspx?Var1=abc&Var2=123'),
'_blank');

</script>

The escape command basically will change all the spaces, ampersighns,
question marks and other special symbols into "safe" codes.

Hope that works a little better for you.
--
http://www.hunlock.com -- Musings in Javascript, CSS.
$FA
Dec 16 '06 #5
Joh said the following on 12/16/2006 7:26 AM:
Joh skrev:
>pcx99 skrev:
>>Joh wrote:
I'm using mailto to open up an email that have a hyperlink in the body.
The hyperlink passes two variables Name and Emailadress. The problem is
that only the first variable Name show up in the hyperlink. It seems
that javascript takes the & as the end of the body where I use it to
separate my variables. Anyone know how to deal with this?

"<script
language='javascript'>window.open('mailto:&body =http://www.abc.com/test.aspx?Var1=abc&Var2=123,
'_blank');</script>"

mailto://ab*@abc.com?body=http://www.abc.com/test.aspx&Name=abc&subject=a
subject!

You didn't ask for it, but I added in a subject too, you can delete it
(&subject...) if you decide not to use it.

Hope that helps you out a bit.

--
http://www.hunlock.com -- Musings in Javascript, CSS.
$FA
Thanks pcx99 for your response but it doesn't answer my question. My
problem is that when I try to pass on two variables Var1 and Var2 with
a hyperlink inside an email that I open with mailto only the first
variable Var1 show up in the hyperlink. It seams that javascript takes
& as the end of the email body where I want to use it to separate my
two varables that are passed on with the hyperlink.


Thanks pcx99 for your response but it doesn't answer my question. My
problem is that when I try to pass on two variables Var1 and Var2 with
a hyperlink inside an email that I open with mailto only the first
variable Var1 show up in the hyperlink. It seams that javascript takes
& as the end of the email body where I want to use it to separate my
two varables that are passed on with the hyperlink.

"<script
language='javascript'>window.open('mailto:&body=ht tp://www.abc.com/test.aspx?Var1=abc&Var2=123,
'_blank');</script>"
Instead of &, try &amp;

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Dec 16 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by nAmYzArC | last post: by
12 posts views Thread by ElvisIsDead | last post: by
15 posts views Thread by Val | last post: by
12 posts views Thread by catyionic | last post: by
10 posts views Thread by Adam Smith | last post: by
15 posts views Thread by Rainman | last post: by
6 posts views Thread by Mike | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.