Walker Farrow
Walker Farrow

Reputation: 3875

plugin needed when displaying inline pdf with object tag

I am displaying an in-line PDF with the following code:

<object data="document.pdf" type="application/pdf" height="400px" width="600px"></object>

For most, this renders fine.

I have a user who is using Firefox version 45 who is getting an error saying "Plugin needed to display this content" - see below image:

Error Message

I am just now starting to use PDFs with HTML so not completely familiar with this - and am only using it for specific purposes and when I need to do it.

Obviously I need it to display properly in all browsers and any help on how I can prevent this from happening would be appreciated.

Upvotes: 0

Views: 563

Answers (1)

Shenole Latimer
Shenole Latimer

Reputation: 326

I took a look at your issue and did some snooping in a bunch of forums and even in the Mozilla help section itself.

As best as I can tell, as of at least 9 months ago according to a couple of the forums I saw, there is no fix for that bug with Firefox 45.

That said, there is a bit of a work-around that you could do to allow visitors to still have access to that PDF. I will give you some code to try and then I will provide an explanation. Here goes...

<object data="document.pdf" type="application/pdf" height="400px" 
width="600px">
    <p>This browser does not support PDFs. Please download the PDF to view 
    it: <a href="document.pdf">Download PDF</a>.</p>
</object>

So basically what is going on is you have to provide a "fall-back" for the visitor to go to so they can download the pdf to look at it. There are other tags you can use, like the embed tag and I believe iframe tag, but the object tag is the only option that allows you to provide a fall-back for your visitors if their browser doesn't support something.

By the way, it is weird if there truly isn't a plugin for Firefox 45, because the tag has been supported in browsers for the longest time!

Anyway, I hope that helps and please post your results. :)

Oh one more thing! Here is a link to a website that has been useful to me. You can use it to see which browsers support a particular thing or not. The site is:

http://caniuse.com/

Upvotes: 2

Related Questions