Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Lolu chungechunge lwabekwa kunqolobane. Uyacelwa ubuze umbuzo omusha uma udinga usizo.

PDFs download instead of PDF.js opening (again?)

more options

I'm updated to v62.0.3, and have autoupdating enabled.

However, the last few updates (apparently) have reset something regarding PDF files.

Now, when I open one (such as Federal Communications Commission actions), the PDF.js viewer (standard with FF) doesn't load, even though "Preview..." is selected for PDFs in about:preferences; instead the file is downloaded.

I only use two extensions, Video DownloadHelper with its "co-app" and Bookmark Dupes. It doesn't appear that either of these were recently updated, and neither appears to be having any issues.

What else should I check that could have been amended as far as options or config?

dL

I'm updated to v62.0.3, and have autoupdating enabled. However, the last few updates (apparently) have reset something regarding PDF files. Now, when I open one (such as Federal Communications Commission actions), the PDF.js viewer (standard with FF) doesn't load, even though "Preview..." is selected for PDFs in about:preferences; instead the file is downloaded. I only use two extensions, Video DownloadHelper with its "co-app" and Bookmark Dupes. It doesn't appear that either of these were recently updated, and neither appears to be having any issues. What else should I check that could have been amended as far as options or config? dL

Isisombululo esikhethiwe

Thanks for the link. The server sends the Content-Type application/octet-stream which indicates a generic kind of binary content. (Screenshot of Browser Console attached.) Firefox doesn't detect/treat that as a PDF (the content type application/pdf triggers that).

Funda le mpendulo ngokuhambisana nalesi sihloko 👍 0

All Replies (14)

more options

this is not a firefox issue on the site off .js the html binds a script inside a html tag "hack", this is common and problematic as browsers have also addon functions so if ya open a pdf the extension can put in the todo api of firefox ,like a mailto: call would open your mail system, but in case a pdf is opened through the webserver html code the browser will execute the .js script sadly these are open source projjects on Git,and in Jquery as piece offf ducktape hackataons try to fool the browser by using html tags and execute scripts, that's why firefox is the first header sign called "Mozilla" as Netscape and Firefox don't run stuff behind your back, but it also opens the "true" reality that since 2015 W3C and browsers have no relation anymore, don't forget a pdf is an product from adobe and Oracle is the company, the conflict with Microsoft ,Google against Adobee is hyge, and by definition a violation off the open source community by stealing the product, like windows runs in .NET framework which is open source, a PDF generator as such can be included on the site you visit, but if the browser updates and the "hack" beccomes obsolete the site is the fault in this, as coder i wrote my own webserver and forked also pdf's inside the WEB but then the browser runs it inside the server,else it opens a new tab with the pdf , as user sadly but also needed to become back a standard and no hidden stuff , the browser is not an OS but the OS like windows runs a shell inside a browser so becomes the border where is the content and you, today 99/100 the external IP request isn't your public but a cloud internal so rendering becomes only visual the data stays on the peer and no data streams to your WAN but you re part off that system, press F12 and check the network tab, the header shows all the info that explains why this happens, rgds marc (coder-zero"

more options

I assume you checked the PDF actions in "Options/Preferences -> General -> Applications".

Is the builtin PDF Viewer enabled?

You can check the handlers.json file in the profile folder to see if there is an action specified. You can use the button on the "Help -> Troubleshooting Information" (about:support) page to go to the current Firefox profile folder or use the about:profiles page.

more options

cor-el: I went to the preferences, and changed the entry for PDFs to "Use... Reader (default)", and it opened a link I selected in a separate Reader window (as it should) Then I changed it back to "Preview..." and selected another link from the same page, and it opened with the internal viewer. In handlers.json I then noticed "mimeTypes":{"application/pdf":{"action":3,"extensions":["pdf"]} What would the "3" mean, internal viewer or external Reader window?

vdbm2: Your response sailed waaaaaay over my head. I haven't coded in over 30 years.

dL

Okulungisiwe ngu Bob Jersey

more options

Action 3 means that Firefox will handle internally.

  • saveToDisk = 0;
  • alwaysAsk = 1;
  • useHelperApp = 2;
  • handleInternally = 3;

Note that Firefox comes with a builtin JSON viewer that should kick in when you open handlers.json in a tab.

more options

Dale_Latimer said

cor-el: I went to the preferences, and changed the entry for PDFs to "Use... Reader (default)", and it opened a link I selected in a separate Reader window (as it should) Then I changed it back to "Preview..." and selected another link from the same page, and it opened with the internal viewer.

Your instinct to turn it off and back on again is something that helped another user earlier this month. That is always worth a try before trashing handlers.json.

more options

jscher2000 said

Your instinct to turn it off and back on again is something that helped another user earlier this month. That is always worth a try before trashing handlers.json.

It didn't help. The other day I changed the Downloads setting to 'always ask where to save'. Then today I opened another FCC file from the link in their daily digest. I got asked where to save the file.

Any other ideas, or am I stuck to have to clean out %USERPROFILE%\Downloads periodically b/c using Reader is, in fact, the default, and something else is unadjustably set to default?

dL

Okulungisiwe ngu Bob Jersey

more options

Action = 4 would be to use the system default application. If the action for PDF is still set to 3 in handlers.json and to Preview in Firefox in Applications then this would suggest that the builtin PDF Viewer isn't working properly and Firefox tries to fallback to an external application.

more options

One possibility is the site intentionally instructed Firefox to treat the file as a download. Sites can bypass inline (in browser) viewing by setting Content-Disposition: attachment on their downloads. Example of that:

I don't know why the FCC would do that unless it was the type of document that should be opened in a more sophisticated viewer (e.g., a fillable form). Can you give the link?

more options

The two links you just gave, worked appropriately, although downloading a fresh package of the pdf.js from https://mozilla.github.io/pdf.js/ may have helped...

jscher2000 said

I don't know why the FCC would do that unless it was the type of document that should be opened in a more sophisticated viewer (e.g., a fillable form). Can you give the link?

https://docs.fcc.gov/public/attachments/DOC-354486A1.pdf

I've also notified the applicable Commission staff of the issue.

dL

Okulungisiwe ngu Bob Jersey

more options

Isisombululo Esikhethiwe

Thanks for the link. The server sends the Content-Type application/octet-stream which indicates a generic kind of binary content. (Screenshot of Browser Console attached.) Firefox doesn't detect/treat that as a PDF (the content type application/pdf triggers that).

more options

The interesting twist here is, MSIE displays it properly. (Chrome saves the file to disk.)

dL

Okulungisiwe ngu Bob Jersey

more options

MSIE has a number of nonstandard behaviors. ;-)

Most importantly for current purposes, MSIE does some content sniffing and will override the Content-Type indicated by the server when it feels like doing so. I'm not aware that the algorithm is documented.

more options

I can now close this. The FCC has remedied the issue, and PDF files there open in the viewer as expected. Thanks for all your help.

more options

In case this comes up again, I created an extension that can help with this problem. I suggest leaving it off until you run into a problem, and only turning it on (using its toolbar button) while you are downloading files that need it. Otherwise, because it intercepts every response from every web server, it may slow down your browsing.

https://addons.mozilla.org/firefox/addon/content-type-fixer/

If anyone tries it, let me know how it goes.