Re: Open certain local files in the browser, not in external application

Achim Schaefer <[email protected]> Mon, 22 Aug 2005 14:22:26 +0200
Newsgroups gmane.comp.mozilla.devel.unix
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
MÃ¥rten Svantesson wrote:

> Achim Schaefer <[email protected]> writes:
> 
>> I have a html page with several links to some files with different names.
>> The files are all simple text files but they do not have the ".txt"
>> suffix.
>>
>> When I open the page with firefox and try to open the linked files, it
>> behaves differently depending on the suffix of the file. Some files are
>> opened directly within the browser window (e.g. a file named "X.output")
>> but for other files (e.g. "Y.log" or "Z.diff"), firefox wants to save the
>> file to disk or have an external application that opens it.
>>
>> I can change the external application, but I can not tell firefox to open
>> the files directly.
>> Note, that all the files are local files and no web-server is involved.
>>
>> How can I tell firefox to open these files directly in the browser
>> window? Can I change the behaviour for all "*.log" files, for example?
> 
> So, you want the .log-files to be handled like plain text files? In
> technical terms you want files with the extension log to be recognized
> as having the MIME type text/plain. The mapping between extensions and
> MIME types are under unix specified (among other places) in the files
> /etc/mime.types and ~/.mime.types. So adding the line
> 
> text/plain log
> 
> to the file ~/.mime.types should do the trick.

Perfect!
Thank you very much.

Achim