PDF files are saved to temp folder before opened
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 ).
פתרון נבחר
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כל התגובות (9)
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
השתנתה ב־
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.
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.
השתנתה ב־
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?
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.
"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.
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.
השתנתה ב־
פתרון נבחר
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.
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.
השתנתה ב־