Pdf.js无法在Internet Explorer上工作

Pdf.js not working on Internet Explorer

本文关键字:Explorer 工作 Internet js Pdf      更新时间:2023-09-26

有人能解释一下为什么这段代码在IE中不起作用吗?在Chrome中,一切都很正常。

我的Html:的一部分

<head>
<script type='text/javascript' src="//code.jquery.com/jquery-1.9.1.js"></script>
<script type='text/javascript' src="http://vivin.net/pub/pdfjs/pdf.js"></script>
<script type='text/javascript' src="http://vivin.net/pub/pdfjs/textlayerbuilder.js"</script>
</head>  
<body>
<div id="pdfContainer" class = "pdf-content"></div>
</body>

适用于Chrome的完整代码和示例:http://jsfiddle.net/vivin/RjqUf/

我已经弄清楚了我的问题所在。我用pdf.min.js替换了pdf.js,现在在Explorer10和Chrome中一切都很好。不知道确切的原因,但它是有效的。

它不起作用的原因是ie9及以下版本不支持pdf.jshttps://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#what-浏览器支持

如果你想强迫用户在ie7,8,9中嵌入pdf,你可以做这个

<embed src="../pdfFileName.pdf" class = "pdf-content">
.pdf-content {your style and size}

如果他们有某种pdf阅读器,这就行了

如果要回退,可以使用<object>标记有一个关于嵌入与对象的讨论EMBED与OBJECT