为了显示它,我采用了多种方法将pdf blob嵌入IE中的html中。
1)创建一个对象URL,并将其传递给embed或iframe标签。在Chrome浏览器中工作正常,但在IE中无法正常工作。
</head>
<body>
<input type="file" onchange="previewFile()">
<iframe id="test_iframe" style="width:100%;height:500px;"></iframe>
<script>
function previewFile() {
var file = document.querySelector('input[type=file]').files[0];
var downloadUrl = URL.createObjectURL(file);
console.log(downloadUrl);
var element = document.getElementById('test_iframe');
element.setAttribute('src',downloadUrl);
}
</script>
</body>
2)我也尝试过将URL Blob包裹在encodeURIcomponent()中>
关于如何解决此问题的任何指示?
为了显示它,我采用了多种方法将pdf blob嵌入IE中的html中。 1)创建一个对象网址,并将其传递给embed或iframe标签。在Chrome浏览器中工作正常,但在IE中无法正常工作。 ...
IE不支持将数据网址作为src属性的iframe。您可以在caniuse中进行检查。它表明该支持仅限于图像和IE中的链接资源(如CSS或JS)。另请检查this documentation: