搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

why does pdf display in chrome not firefox

  • 11 个回答
  • 1 人有此问题
  • 1 次查看
  • 最后回复者为 cor-el

more options

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

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"/> <div class="head_2"> There is a problem with your browser </div> </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

由addsimm于修改

所有回复 (11)

more options

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?

由cor-el于修改

more options

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.

more options

No issue with the site you listed but thing is I have Acroboat 11 Pro installed so that might be showing it differently.

more options

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?

more options

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.

more options

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.

more options

I think so; for example PDFs are displaying on other pages and I have disabled all blockers

what kind of button would you recommend?

more options

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).

more options

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?

more options

yes it works when the base code64 string is pasted in the uri box; however the pdf is immediately downloaded as a file.

more options

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".