why does pdf display in chrome not firefox
Using the current versions of both browsers, my embedded PDFs display fine in chrome but not in Firefox.
I have tried various combinations of code, using this as a base:
<object id="object_element" data="data:application/pdf;base64, {{ pdf_contents }}"> <embed id="embed_element" src="data:application/pdf;base64, {{ pdf_contents }}" type="application/pdf"/>
There is a problem with your browser
</object>
So that, and that without an object tag and without a div tag. I also tried loading it as a file, under src, from the server
Invariably the message displays in Firefox and the PDF in chrome
Edeziri
All Replies (11)
Do you have a test page, so we can check it out?
Can you open the PDF file with the PDF Viewer if you paste the data URI in the location/address bar ?
Did you check the Web Console for error messages?
Edeziri
Here is a test page:
https://www.joinourstory.com/jos_stories/story_reader/?story_id=377
Its delivered as a sting, so the uri is not a possibility
there are no console errors.
Thanks.
No issue with the site you listed but thing is I have Acroboat 11 Pro installed so that might be showing it differently.
Works fine here as well. I'm not seeing the need for both object and embed (length: 57008) because there is no classid or other data for IE in the object that would make Firefox ignore the object.
Can you open the data URI (data:application/pdf;base64,xxxx) in a tab like I posted above?
Thanks for your attention; it is a relief to hear it is working for you
I have tried it with and without the embed and with and without the object.
When I entered he string into the URI it downloaded the pdf properly but did not display it. That's probably an important finding ..
On the other hand the message is still there from the site.
Have you ruled out all of your content blockers as the potential source of the issue?
Extensions such as Adblock Plus, Blur, Disconnect, Ghostery, NoScript, Privacy Badger, uBlock Origin or uMatrix should provide toolbar buttons to manage blocked content in a page. There may or may not be a number on the icon indicating the number of blocked items; you may need to click the button to see what's going on and test whether you need to make an exception for this site.
I think so; for example PDFs are displaying on other pages and I have disabled all blockers
what kind of button would you recommend?
addsimm said
what kind of button would you recommend?
Oh, I was referring to any buttons added to your toolbar by add-ons you might be using, not a button for users of the site.
I think if you are concerned that some site visitors also won't see the PDF, you could change the fallback text inside the object to a link to the PDF that could open in its own tab (or externally to Firefox).
You still haven't confirmed whether it works or doesn't work when you paste such a PDF data URI link in the location bar, so could you please check this out?
yes it works when the base code64 string is pasted in the uri box; however the pdf is immediately downloaded as a file.
Firefox should use the builtin PDF Viewer if you open the file via the location/address bar. If that isn't working then it sounds that the PDF Viewer isn't enabled or otherwise not working. That would explain why it isn't working with the object tag.
Check the setting for Portable Document Format in "Options/Preferences -> General -> Applications" to see if it is set to "Preview in Firefox".