Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

ابحث في الدعم

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

PDF files are saved to temp folder before opened

  • 9 ردود
  • 1 has this problem
  • 1 view
  • آخر ردّ كتبه Christian

more options

When selecting "Open in Firefox" in the "What do you want to do with this file?" box or on about:preferences and then opening a PDF file on the web, instead of downloading the file to RAM and opening it with its online address, Firefox downloads the PDF to /tmp/mozilla_${USER}0 and opens it from there. This also adds it to the download history. I have set the about:config flag browser.download.start_downloads_in_tmp_dir to true so the files I just open and don't want to permanently download don't clutter my $HOME/Hämtningar (downloads) folder. I tried to first prevent that by selecting the default action to do when tasked to open a PDF, but that didn't fix it, so I set the about:config flag. Unfortunately, setting the default action stopped Firefox from opening a PDF inline without downloading it and I cannot find any option along the lines of "Preview in Firefox" (as described in this support article ).

When selecting "Open in Firefox" in the "What do you want to do with this file?" box or on '''about:preferences''' and then opening a PDF file on the web, instead of downloading the file to RAM and opening it with its online address, Firefox downloads the PDF to '''/tmp/mozilla_${USER}0''' and opens it from there. This also adds it to the download history. I have set the '''about:config''' flag '''browser.download.start_downloads_in_tmp_dir''' to true so the files I just open and don't want to permanently download don't clutter my '''$HOME/Hämtningar''' (downloads) folder. I tried to first prevent that by selecting the default action to do when tasked to open a PDF, but that didn't fix it, so I set the '''about:config''' flag. Unfortunately, setting the default action stopped Firefox from opening a PDF inline without downloading it and I cannot find any option along the lines of "Preview in Firefox" (as described in [[How do I OPEN and read pdf docs on line rather than download, save and then read and delete. This only happens on some sites & started recently.|this support article]] ).

الحل المُختار

Switching from "Open in Firefox" to "Always Ask" or "Save File" and then back again still works as expected for me with your example PDF.

Backup your profile folder and try deleting the handlers.json file.

Read this answer in context 👍 1

All Replies (9)

more options

The support article link is somehow broken and I don't know how to edit it, so here's the working link: https://support.mozilla.org/sv/questions/985483

Modified by Christian

more options

That isn't a support article, it's a question marked as solved. It's an old question and downloading was significantly changed recently (version 98, IIRC).

Firefox has to download a file to open it. The /tmp file should be cleared by your OS at some point. You can change fstab to have /tmp open in RAM, if you have enough RAM.

more options

Terry said

[…] Firefox has to download a file to open it. […]

I am aware that it needs to download the files to open them (how else should it get the data to display?) but I mean opening it in the context of the website. Before I selected a default action for PDF files it would download the file but not to disk. It would simply load the contents into pdf.js directly from the web server and show the server's address in the address bar (instead of the local /tmp file path) and not add the file to the download history. It's that behaviour I somehow want to get back. I checked, Firefox in the current version can do that (I opened a new profile and went to my website to open the test PDF and it opened like I wanted it to open, see the first attached screenshot). In my current profile it opens as a download, see the second screenshot. I want to get back to the original behaviour but I don't seem to be able to do so, no matter what I set the setting for it to.

Modified by Christian

more options

Christian said

I opened a new profile and went to my website to open the test PDF and it opened like I wanted it to open

So there's something up with your profile. Does it still happen in Troubleshoot Mode?

more options

zeroknight sade

Does it still happen in Troubleshoot Mode?

Yes, it does. Like I said, it began when I set the default action for opening PDF files to "Open in Firefox". It would probably be nice if a dev added a "Preview in Firefox" option to that menu in about:preferences.

more options

"Open in Firefox" is the default setting for PDFs in a new profile though and you already confirmed that it works, so it must be something else with your profile.

Try resetting all the browser.download.* settings to default in about:config.

more options

zeroknight sade

Try resetting all the browser.download.* settings to default in about:config.

That doesn't seem to do anything. By the way, the "Open in Firefox" is visually selected by default, but the behaviour is different after setting it to another alternative and then back to "Open in Firefox". By the way, I already tested setting browser.download.start_downloads_in_tmp_dir to true in the new profile and the PDF file still opens exactly the way I want it to, as the setting only affects downloads and not opening without downloading to a file.

Modified by Christian

more options

الحل المُختار

Switching from "Open in Firefox" to "Always Ask" or "Save File" and then back again still works as expected for me with your example PDF.

Backup your profile folder and try deleting the handlers.json file.

more options

zeroknight sade

Backup your profile folder and try deleting the handlers.json file.

That caused Firefox to only download the file (to my downloads folder, without even asking where to put it) and not open it. Directly typing an address would open it as wanted, just opening it through a link would download and then open it, even though I was the one who made the link on dateien.lampe2020.de/show_dir.php, and I made it to only open, not force a download or anything.

Interestingly, after restoring it from my backup and setting the default action to open it now opens it without saving to a file.

Modified by Christian