加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

html – 在iframe srcdoc值中转义引号

发布时间:2020-12-14 18:56:35 所属栏目:资源 来源:网络整理
导读:根据 spec的报价必须转义,即代替: iframe seamless sandbox srcdoc="pYeah,you can see it a href="/gallery?mode=coveramp;page=1"in my gallery/a."/iframe 我们应该使用: iframe seamless sandbox srcdoc="pYeah,you can see it a href=quot;/gallery?m
根据 spec的报价必须转义,即代替:
<iframe seamless sandbox srcdoc="<p>Yeah,you can see it <a href="/gallery?mode=cover&amp;page=1">in my gallery</a>."></iframe>

我们应该使用:

<iframe seamless sandbox srcdoc="<p>Yeah,you can see it <a href=&quot;/gallery?mode=cover&amp;amp;page=1&quot;>in my gallery</a>."></iframe>

但是在上面的例子中简单地使用单引号是不行的:

<iframe seamless sandbox srcdoc="<p>Yeah,you can see it <a href='/gallery?mode=cover&amp;page=1'>in my gallery</a>."></iframe>

解决方法

您链接的规范仅注意到引号被转义,因为

otherwise the srcdoc attribute would end prematurely.

使用单引号没有问题,如上一个例子所示.

如果价值中有单引号(例如,“你是”),那么你必须逃避任何一个或另一个.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读