7

Can anyone explain me why this code don't work in IE? In Chrome everything works just fine.

Part of my 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>

Full code and example that works on Chrome: http://jsfiddle.net/vivin/RjqUf/

maxus182
  • 161
  • 1
  • 1
  • 10

2 Answers2

5

I've figured out what my problem was. I replaced the pdf.js with pdf.min.js and now everything works fine in both Explorer 10 and Chrome. Don't know exactly why, but it works.

maxus182
  • 161
  • 1
  • 1
  • 10
0

the reason it doesnt work is because pdf.js is not supported by ie9 and below https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#what-browsers-are-supported

if you want to force users to embed pdf in ie7,8,9 you can do this

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

this works if they have somekind of pdf reader

if you want fallback you can use <object> tag there is a discussion EMBED vs. OBJECT about embeding vs object

Community
  • 1
  • 1
nolawi
  • 4,439
  • 6
  • 22
  • 45
  • 1
    Additional info: The reason why older IEs are not supported is because pdfjs [uses](https://github.com/mozilla/pdf.js/blob/master/src/display/canvas.js#L35) `canvas`, wihch is not implemented in IE<10 – user123444555621 Apr 26 '14 at 14:43
  • Thx for the answer, I know about the IE9 and older, but in IE10 should work right? I just don't understand what's wrong with the code? – maxus182 Apr 26 '14 at 14:54