By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,475 Members | 1,075 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,475 IT Pros & Developers. It's quick & easy.

Mailto question

P: n/a
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
Share this Question
Share on Google+
5 Replies

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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.