Escape & symbol in MailTo

 ̄綄美尐妖づ 提交于 2019-12-23 03:10:20

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/5288527/escape-symbol-in-mailto

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!