逃脱& MailTo中的符号 [英] Escape & symbol in MailTo

查看:183
本文介绍了逃脱& MailTo中的符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个这样的URL: http:// localhost:9001 / view / shopindex / display?keyword = test& searchPostcode = Postcode ,我把它放在一个新的电子邮件正文中使用HTML mailTo(我知道有更好的选择mailTo但是我被限制对此)。有效地,我有这个:

 < a href =mailto:?subject =看这个链接& amp; body = http ?://本地主机:9001 /视图/ shopindex /显示关键字=试验&放大器;放大器; searchPostcode =邮编>< / A> 

问题是当我点击并打开新的电子邮件时,我才会收到身体中的以下内容:



我认为 mailto 将网页URL的查询字符串中的& 符号标识为mailto URL的一部分。有没有办法逃避它?



谢谢!



Krt_Malta

解决方案

请尝试用&编码&符号字符:

  http:// localhost:9001 / view / shopindex / display?keyword = test%26searchPostcode =邮政编码

它在Firefox中适用于我,您可以测试它 here


I have a URL like this: http://localhost:9001/view/shopindex/display?keyword=test&searchPostcode=Postcode and I'm putting it in the body of a new email message using HTML mailTo (I know that there are better options to mailTo but I'm restricted to this). Effectively I have this:

<a href="mailto: ?subject=Look at this link&amp;body=http://localhost:9001/view/shopindex/display?keyword=test&amp;searchPostcode=Postcode"></a>

The problem is that when I click and I get the new e-mail message opened, I get only the following in the body:

http://localhost:9001/view/shopindex/display?keyword=test

I think the mailto is identifying the & symbol in the query string of the web page URL as part of the mailto URL. Is there a way I can escape it?

Thanks!

Krt_Malta

解决方案

Try URL-encoding the ampersand character instead:

http://localhost:9001/view/shopindex/display?keyword=test%26searchPostcode=Postcode

It works fine for me in Firefox, you can test it here.

这篇关于逃脱&amp; MailTo中的符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆