我想在HTML电子邮件中使用Google+分享按钮。我把超链接
https://plus.google.com/share?url={URL}
进入电子邮箱。
但是当我尝试超链接时,GET数据存在问题。如果我将?parameter=name
放入网址,则说明不会接受该网址。
如何发送正确的网址?
答案 0 :(得分:0)
根据documentation,url
值必须经过网址编码。
E.g。 http://example.com/?foo=bar
应为http%3A%2F%2Fexample.com%2F%3Ffoo%3Dbar
https://plus.google.com/share?url=http%3A%2F%2Fexample.com%2F%3Ffoo%3Dbar
在JavaScript中,您可以使用encodeURIComponent('http://example.com/?foo=bar')