PDFObject returning false in Firefox

1.6k views Asked by At

I ran into this while testing a website. In Chrome the "Nothing?" text disappears and if you look at the console the pdfobject is printed. But, when you do the same in Firefox you get false. This a known bug? jsFiddle

javascript:

var pdf = new PDFObject({url: '/climatesummary/2014_02_climatesummary.pdf'}).embed("pdf");
console.log(pdf);

html:

<div id='pdf'>Nothin?</div>
1

There are 1 answers

0
pipwerks On BEST ANSWER

Firefox's built-in PDF renderer is PDF.js, which does not expose itself to JavaScript the way traditional plugins do. Because of this, PDFObject does not currently support PDF.js detection. If Firefox is using PDF.js as the default PDF rendering option, PDFObject will fail.

However, if you use pure markup to embed your PDF instead of JavaScript, your PDF will display just fine. Example: http://pdfobject.com/markup/examples/sized-element.html