Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Firefox determines which program to use to open a download based on the download's MIME type. More information on that can be found in Mozilla's online documentation.

It seems to me that when Firefox encounters a MIME type it has no configuration for, it prompts the user to open it in Gedit. Why Gedit? How can I change the default for unrecognised MIME types to gnome-open?

share|improve this question
    
Can you give a specific example, so that I can modify my answer, if needed? –  IgnitE Feb 17 '13 at 0:28
    
@IgnitE: sorry, can't find one right now. –  Flimm Feb 17 '13 at 16:08

2 Answers 2

up vote 2 down vote accepted

Introduction to the Content-Type header:

Every HTTP response contains a header named Content-Type, it contains the MIME type of the returned data stream. For example, the MIME type could be text/plain or text/html.

Servers are usually configured to set the Content-Type header to application/octet-stream when it can't determine itself what the file type of the download is. This is why you annoyingly don't get the correct suggestion on downloading new or non-universal file types, like .deb files.

Changing the default action for new and unrecognised MIME types:

For new and unrecognised MIME types, you can simply set the default action by ticking the "Do this automatically for files like this from now on" checkbox in the download prompt. The checkbox is disabled initially, but you can enable it by clicking the radio button next to "Open with" or changing the default application.

You'll be able to review your choices by opening the Applications tabs under Edit, Preferences.

Changing the default action for application/octet-stream:

For some reason, Firefox won't let you change the default action for application/octet-stream files. You will have to change the user's default handler for that MIME type, like this:

  1. Open ~/.local/share/applications/mimeapps.list.
  2. Find the line beginning with application/octet-stream= under [Added Associations]. If it's not there, create it.
  3. On the right hand side of the equals sign, put: gedit.desktop;, or whichever .desktop you want to use.

Changing the default action for application/octet-stream to gnome-open:

In my case, I want to default to gnome-open, but it doesn't have a pre-existing .desktop file, so I created one under ~/.local/share/applications/ with these contents:

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Exec=gnome-open %f
Name=gnome-open
Comment=Custom definition for gnome-open
NoDisplay=true
share|improve this answer

The setting for mime types in firefox is stored in helpers.global_mime_types_file and helpers.private_mime_types_file. You can see their values in about:config : mime_types_file
Also default applications for mime types are stored in either ~/.local/share/applications/mimeapps.list or in /usr/share/applications/defaults.list. In my case, this line application/octet-stream=gedit.desktop; was present in mimeapps.list and hence firefox prompted to open some applications in gedit. You can change it to some different application of your choice.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.