home |  electronics |  toolbox |  science club |  tuxtalk |  photos |  e-cards |  online-shop



fixed -- Firefox Quantum unable to open shtml files

Shtml files are normal html file with some additional "code" for server side includes. Most of the content of the raw file (not server side expanded) is in general html and during html page writing one would like to be able to open those files just with file:// straight from the computer without a web server. This used to work with any firefox version that I can remember but it stopped suddenly when I installed Firefox 57 (or 58).

firefox shtml mime type bug
firefox shtml mime type bug


Firefox 57 (or 58) does not know anymore what to do with local shtml files openend via file:// It is asking for the application to use to open that file. If you force firefox to use firefox as the application then the whole thing goes into an endless loop.

The problem is that firefox does not know anymore that it should be firefox that can open shtml files as text/html mime-type files. In linux mime types for file endings are defined in /etc/mime.types and shtml is there:

$ grep shtml /etc/mime.types text/html html htm shtml

Firefox is supposed to read that file but something is wrong with the parsing of the file:

firefox is configured to read /etc/mime.types
firefox is configured to read /etc/mime.types but it does not seem to work.


My work-around used to be to just rename the .shtml files temporarily to .html but it is very annoying to work that way.

Solution: create a ~/.mime.types file

Firefox reads in addition to /etc/mime.types the ~/.mime.types file from your home directory if available. A couple of days ago I decided therefore to just check what happens if I create a ~/.mime.types file with one line in it:
more ~/.mime.types text/html shtml
That fixed the problem. Now firefox knows that local files ending in .shtml are html documents. The surprising thing is that once you have opened a shtml file (e.g file:///tmp/t.shtml ) then firefox seems to cache the information about handling .shtml files and you can actually remove ~/.mime.types again. The problem is solved. A very strange software bug.

Back to: "No preservatives added"



Copyright © 2004-2018 Guido Socher