【发布时间】:2018-01-22 19:02:59
【问题描述】:
在 blogspot 模板引擎中,如何转义帖子 URL 以将其用作查询参数,以便可以在 facebook/twitter/任何按钮和 iframe 中使用它?
问题:我有一个带有 src 的 iframe,它需要一个 URL。
<iframe src="https://www.facebook.com/plugins/like.php?href=MY_URL_GOES_HERE">
所以说我的帖子网址是http://example.blogspot.com/1999/01/first.html。我需要将:/. 转换为百分比编码字符,以及?&% 等。否则我会得到这个:
<iframe src="https://www.facebook.com/plugins/like.php?href=http://example.blogspot.com/1999/01/first.html">
而且看起来它总有一天会被打破。如何在博客中转义 URL?
【问题讨论】:
标签: facebook twitter blogger blogspot