How to display *.html.gz files in browser for local files
I need to find a way to allow Firefox to display gzipped local files named like *.html.gz in the browser, for a new application I am working on.
Netscape 4.79 can do this, but it's very out-of-date and lacks modern Javascript and CSS support.
The behaviour of Firefox on local files named *.html.gz is to download them. Why? The files are already saved on the local disk...
Is there a configuration setting I can change to make Firefox display these files?
Ideally, ANY local file with a double extension of *1.*2.gz should be decompressed in the browser. Where *1 would be a name and *2 would be a file type that the browser can normally display (like HTML) or load (like Javascript/CSS,etc.).
If a user really does want to download a local file of this type, there could be a right click option like "Save Link As Uncompressed" or an option in Firefox config to switch this behaviour off.
Needing to run a webserver on the PC just so the browser can display compressed html is a bit ridiculous...
所有回覆 (4)
Why do you have gzipped HTML files?
If a web server transmits a page with a response header indicating that the body of the response is gzipped, then Firefox does know how to decompress it. However, I don't know whether you can fake that with a local file.
Can any of your other browsers open those files?
I am compressing the files with gzip before they are to be transmitted via radio broadcast. Compressing the files reduces the size to less than half, and improves performance by allowing a slower and more robust modulation method and better error correction.
Only Netscape 4.79 can open these files directly.
Yes, I am currently running a simple web server to serve the folder contents to localhost, with the correct headers.
But the browser *could* decode the *.html.gz files if it was possible to configure it to, and it would be far simpler and less trouble for other people to use.
Here are some places to submit feature suggestions, depending on your desired style of interaction:
Discussion Sites/Advocacy
- Mozilla Discourse: https://discourse.mozilla.org/
If none of the categories seem to fit, try https://discourse.mozilla.org/c/firefox-development - Reddit (monitored by Mozilla): https://www.reddit.com/r/firefox/
- I saw someone created a Change.org petition but I don't know who sees those
- Twitter (Mozilla official): https://twitter.com/firefox
Bug Tracking System
- Unfortunately, new feature requests tend to get a low priority: https://bugzilla.mozilla.org/
- See: Bugzilla Etiquette
Thanks for your helpful suggestions. I will follow those up.
I do still wonder if there is some hidden way to get the browser to read the *.html.gz local files though....
In the past, this current behaviour of not decoding local files has been regarded as a bug by others: https://bugzilla.mozilla.org/show_bug.cgi?id=52282