




















这是一个创建于 971 天前的主题,其中的信息可能已经有所发展或是发生改变。
遇到个蛋痛事。对于同一个 1.svg ,页面里分别用 <img> 和 <embed> 嵌入
<img src="1.svg">
<embed src="1.svg">
前者不能展示 svg 内部的<image>图片 ,后者能展示。
在线 demo 有人遇到过这个问题吗?
1 sanmaozhao 2023 年 10 月 18 日查到的资料说,img 标签嵌入的 svg ,是无法加载任何外部资源的 请看这个链接 This is mainly because images with <img> tags are not allowed to refer to external resources including CSS, fonts and scripts, for security reasons. 但是我目前还没查到官方的文档说明 |
2 sanmaozhao 2023 年 10 月 18 日找到权威一些的文档了,看来就是这个原因了 https://www.w3.org/wiki/SVG_Security Markup languages like HTML (and SVG itself) can reference SVG as an image with the <img> tag (HTML namespace) or <image> tag (HTML or SVG namespace). If an SVG file is fetched as image, then certain requirements apply to this document: The SVG document is not allowed to fetch any resources. This also applies to scripts, stylesheets or images. |
4 sanmaozhao 2023 年 10 月 18 日哈哈,找到原因应该回复一下本贴啊 我也查了有一会儿,才找到根源 也是顺着几个链接找到的,和你博客里贴的基本相同 |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。