【问题标题】:HTML code set as src in iframe not showing in IE 11在 iframe 中设置为 src 的 HTML 代码未在 IE 11 中显示
【发布时间】:2018-02-19 14:32:31
【问题描述】:
<html>
<head>
</head>
<body>
<iframe id='smartPartFrame' src='data:text/html;charset=utf-8,<h1>inteGREAT</h1>' scrolling='no' width='1000px' height='70px'></iframe>

</body>
</html>

上面的 html 代码用于在 iframe 中显示 h1。 Chrome、Firefox、Edge 运行良好。 IE 11 显示错误:无法显示页面。我想直接在 src 中设置 html 而不是文件路径。

【问题讨论】:

标签: html iframe internet-explorer-11


【解决方案1】:

Internet Explorer 11 不支持 iframe 中的数据 URI,也不支持在 iframe 中嵌入 HTML 的任何其他方式。

在标准中执行此操作的“预期”方式是使用srcdoc 属性,而不是给定数据URI 的src 属性,而是browser support for srcdoc remains poor

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-16
    • 2019-08-17
    • 2015-11-11
    • 2015-12-02
    • 1970-01-01
    • 2014-08-04
    相关资源
    最近更新 更多