Download txt html and other files no longer automatic and that setting is disabled
From your help pages concerning file downloads 'Is Do this automatically for files like this from now on disabled? This can happen if the website's server incorrectly specifies the Internet Media type of the file. It also can happen if the server assigns "Content-Disposition: attachment" to the file. '
Then now apparently everyone who has .txt files set to be downloaded falls into one or the other of those two categories above, and every time I wish to download a .txt I have to go through this rigmarole to get it to download, and every time making such downloads automatic is disabled.
I want .txt files to download automatically, as they used to do. Firefox is behaving as if I am only ever going to download .txt files from this one site. The fact that one particular site may not be fulfilling every pettifogging detail of html protocol is NOT a valid reason for firefox to disable automatic downloads of .txt files from every web site.
Vybrané riešenie
Thank you for the clear explanation of what is happening.
I get this problem at multiple sites, projectgutenberg, fadedpage, archiv etc which give a choice of options for downloading a file in various formats, mobi, epub, pdf, html, txt, zip etc.
The choices say "Download" and for most of them that is exactly what happens, but not for html and txt. They behave in one of the two ways you described.
Sure, I can download txt and html, but the process is not automatic as with other file types, and as a user who sees a computer as a device to automate tasks, it is very aggravating. But I guess calling it a rigmarole is a mite excessive.
Čítať túto odpoveď v kontexte 👍 0Všetky odpovede (14)
What is the rigmarole --
Then now apparently everyone who has .txt files set to be downloaded falls into one or the other of those two categories above, and every time I wish to download a .txt I have to go through this rigmarole to get it to download, and every time making such downloads automatic is disabled.
Do you mean clicking Save in the Downloads dialog?
I want .txt files to download automatically, as they used to do. Firefox is behaving as if I am only ever going to download .txt files from this one site. The fact that one particular site may not be fulfilling every pettifogging detail of html protocol is NOT a valid reason for firefox to disable automatic downloads of .txt files from every web site.
Is this problem specific to one site?
If a file is sent with the Content-Type text/plain then Firefox will display it in a tab unless the server instructs otherwise, by setting Content-Disposition: attachment. If the server says the file should be downloaded, then Firefox should follow the setting on the Options page for Text documents.
On the other hand, if a file is sent with the generic Content-Type application/octet-stream then Firefox will never try to display it in a tab, but also won't allow you to store a specific action for it since this Content-Type is not linked to a particular file type.
Is it possible to use the workaround:
right-click the link to the file > Save Link As...
Vybrané riešenie
Thank you for the clear explanation of what is happening.
I get this problem at multiple sites, projectgutenberg, fadedpage, archiv etc which give a choice of options for downloading a file in various formats, mobi, epub, pdf, html, txt, zip etc.
The choices say "Download" and for most of them that is exactly what happens, but not for html and txt. They behave in one of the two ways you described.
Sure, I can download txt and html, but the process is not automatic as with other file types, and as a user who sees a computer as a device to automate tasks, it is very aggravating. But I guess calling it a rigmarole is a mite excessive.
With what content type are these files send?
gl00637@gmail.com said
I get this problem at multiple sites, projectgutenberg, fadedpage, archiv etc which give a choice of options for downloading a file in various formats, mobi, epub, pdf, html, txt, zip etc.
I tried this page as an example:
https://www.gutenberg.org/ebooks/19073
The "Plain Text UTF-8" returns a text/plain file that Firefox happily opens in a tab. I don't get a download dialog at all.
If I use the "More Files…" link then there are a couple .txt file links that return a text/plain file that Firefox also shows in a tab.
Since html and text are pretty fundamental to web browsing -- you very rarely want those files to download instead of displaying in a tab -- overriding the natural behavior would be somewhat risky.
One possible option would be to find an add-on that modifies the relevant links or creates new ones. I took a look at the simplest type of modification, which is to add the download attribute to the link to pop up a download dialog.
Adding the download attribute to the plain text link on the /ebooks/ page does not work:
<a href="//www.gutenberg.org/ebooks/19073.txt.utf-8" type="text/plain" class="link" title="Download" download="cocoa.txt">Plain Text UTF-8</a>
I think it's because there is a redirect from https to http, and that may be violating the "same-origin" restriction on the download attribute.
Perhaps that is why this also does not work:
<a href="http://www.gutenberg.org/ebooks/19073.txt.utf-8" type="text/plain" class="link" title="Download" download="cocoa.txt">Plain Text UTF-8</a>
If I change the URL to the ultimate destination under /cache/ using a relative URL so it is HTTPS, that works, but this information about the ultimate URL is not readily available to a script in the page:
<a href="/cache/epub/19073/pg19073.txt" type="text/plain" class="link" title="Download" download="cocoa.txt">Plain Text UTF-8</a>
If I click More Files... and look at the /files/ list, it seems we do not have to worry about a redirect. However, we also cannot see the book title here to construct a nice file name.
So /files/ isn't a good page to modify, but it gives us a better understanding of additional paths to the files on the server. If we can determine the pattern, we can inject a new link/button in the /ebooks/ page that has the exact behavior we want.
A fun project for someone. Or maybe an extension or userscript for this is already out there??
jscher2000 said ... Since html and text are pretty fundamental to web browsing -- you very rarely want those files to download instead of displaying in a tab -- overriding the natural behavior would be somewhat risky. ...
Sorry, but I don't buy that argument at all. Much of Linux documentation is available as directly downloadable html files. The three sites I named are primarily or solely sites from which to download files. They invite me to download various file-types, not to view some of them in a browser instead.
If it is more reasonable to display txt and html in the browser, then for consistency firefox should also display the 'Download pdf' option on such sites. But no, pdfs download directly, therefore txt and html should do likewise.
It was kind of you to investigate the possibility of modifying firefox's behavior via external scripts, but I think that would be an option more laborious than simply living with the status quo. Firefox seems to get updated more often than any other app (apart from linux itself), and each such update would have the potential to break any script I might write.
Well, if it gets too laborious, you have some options to consider.
You can set browser.altClickSave to true on the about:config page and hold the alt key if you click the link, that should give you a download dialog. Otherwise use the right-click context menu.
I have a similar problem. I want to use macros (via iMacro) to automate download of text files from multiple pages. The start url is:
I can get the macro to work up till the point where I press "Download" but then up pops the dialogue box which of course interrupts the macro. What I want is for the text files to download automatically.
There is no opportunity in the Options screen to tell Firefox how to behave for text files.
I have tried editing handlers.json by adding a line as so: "extensions":["txt"]},"text/csv":{"action":0,
but this seems to be overwritten when I reload Firefox. Version 68.0.2, Windows 10 pro.
Any ideas?
Hi Ian S, can your macro right-click a link, choose Save Link As..., and then submit the file browsing dialog?
If not, I think you are in the same situation and you either need to modify the link before clicking it or use an extension to modify how Firefox receives the file (add a Content-Disposition: attachment header).
Many thanks for that. No, can't do that as the download is via a button and an event procedure (I assume) rather than a hyperlink.
Where would I put that string you suggest as that sounds as though it may be a good approach?
Ah, just realised you mean that needs to be in the target file (I think....). I don't have access to that.......
Ian S said
Many thanks for that. No, can't do that as the download is via a button and an event procedure (I assume) rather than a hyperlink. Where would I put that string you suggest as that sounds as though it may be a good approach?
The download attribute is for hyperlinks, so probably not useful in the case of a button, although I haven't tested.
The Content-Disposition header needs to be sent from the server or injected by an extension when Firefox is receiving the file from the server.
Thanks again. I have to say I'm not really up to speed with the process....
I have no way of controlling what the server gives me so probably my only hope is the extension you suggest. Could you possibly outline what I would need to do (Firefox extension etc)?
Ian S said
Could you possibly outline what I would need to do (Firefox extension etc)?
Unfortunately, there doesn't appear to be a purpose-built extension to force a download of .txt files; generally it's the opposite (stripping off Content-Disposition: attachment so Firefox will display the file "inline").
There are extensions to add headers, but I haven't tried them myself. For example: