In my web app, I use a mailto link to open the outlook 2007. I also insert a url into the body. The problem is I need the whole url to be a hyperlink. If there is any spaces, then the hyperlink breaks, or even if there is any special characters like if it ends with a close parenthesizes the character wont be included in the hyperlink, so the link breaks.
What I tried was using encodeURIComponent
on the link, which url encodes it, but the issue is that in outlook, it will automatically decode it back to normal which then breaks the link. What I need is a way to double encode it.
Basically instead of doing
" "
-> "%20"
(<-- encodeURIComponent
)
I need
" "
-> "%2520"
So that in outlook, the %25
gets decoded to %
, which when bines with the 20
so I get %20
keeping the link encoded once and not broken. This is what would work for me, but I just don't know how to do this function.
Does anyone know how I can do this double encode?
Thanks
In my web app, I use a mailto link to open the outlook 2007. I also insert a url into the body. The problem is I need the whole url to be a hyperlink. If there is any spaces, then the hyperlink breaks, or even if there is any special characters like if it ends with a close parenthesizes the character wont be included in the hyperlink, so the link breaks.
What I tried was using encodeURIComponent
on the link, which url encodes it, but the issue is that in outlook, it will automatically decode it back to normal which then breaks the link. What I need is a way to double encode it.
Basically instead of doing
" "
-> "%20"
(<-- encodeURIComponent
)
I need
" "
-> "%2520"
So that in outlook, the %25
gets decoded to %
, which when bines with the 20
so I get %20
keeping the link encoded once and not broken. This is what would work for me, but I just don't know how to do this function.
Does anyone know how I can do this double encode?
Thanks
Share Improve this question asked Aug 23, 2013 at 15:56 omegaomega 44k90 gold badges286 silver badges523 bronze badges1 Answer
Reset to default 6Encode
var encoded=escape(encodeURIComponent(' '));
Decode
var decoded=decodeURIComponent(unescape(encoded));
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744268649a4565988.html
评论列表(0条)