emmeowzing
emmeowzing

Reputation: 2171

Open program files in the Firefox browser window

I wanted to open the get-pip.py file in a new tab so that I could view it, but in Firefox, unlike Chrome, I cannot find a way to view code in a tab with an odd extension. When clicking on the code it asks if I want to download it, but I don't want to.

When I selected Firefox as the default program to open it (hoping it would just treat it like a text file or something, the same way Chrome handles odd extensions like .new) new tabs kept opening like a runaway freight train! It was difficult to get it under control and salvage my session.

Does anyone know how I may modify Firefox so that it will treat extensions like .py as a text file and open it in a new tab?

Upvotes: 2

Views: 1106

Answers (1)

Aaron
Aaron

Reputation: 305

My version of your problem was solved like so: (on Linux)

cp /etc/mime.types ~/.mime.types # Note the dot in front of .mime

Edit ~/.mime.types, and comment out or delete everything but this:

text/plain     asc txt text pot brf srt lua py

Add whatever file types you want to force as text/plain. In the above example, I added lua and py, they were not in the original /etc/mime.types.

Restart Firefox.

Note that this is for all apps that look at that/those files, not just Firefox. For example, if you run a web server, depending on the server, it may also affect that. This is why I did it in my home dir rather than /etc.

How I figured it out:

about:config
mime

This shows three settings:

helpers.global_mime_types_file    /etc/mime.types
helpers.private_mime_types_file    ~/.mime.types
plugin.java.mime    application/x-java-vm

In my case I did not have the private file, so I did the copy/edit/restart as above.

Also Note: I can't get this to work for C files.

Upvotes: 2

Related Questions