Firefox: viewing text files in external editor

3

1

I would like to make Firefox view text files not in its internal editor, but in the external editor (namely EmacsClient).

Is it possible to change this default behavior of Firefox?

EDIT: I beg your pardon for being inconcise, I'll try to state the matter once again. First thing to mention is that I use the Linux version of Firefox. That means that unlike the Windows version the contents of the application bindings dialog is very scarce.

When I click on the link to a text file (be it remote or local) by default Firefox opens it in the internal browser. I've tested, somehow it looks at file extension - when for example I make a file with .mpg extension, the behaviour is as it should be - the dialog with "Open With..." and stuff. When the file has unknown extension (unknown to /etc/mime.types), in my case it's .out, pure text format - the default behaviour is to open it in a Firefox window. That very thing I need to change.

user69285

Posted 2011-03-10T10:30:16.530

Reputation:

Answers

2

Try: Tools > Options > Applications, scroll down to Text Document, and change the entry there.

If the entry does not exist, you must edit the mimeTypes.rdf file in your profile directory.

pepoluan

Posted 2011-03-10T10:30:16.530

Reputation: 962

@pepoluan: Sorry, my fault. Should have said that i'm on linux. I'll update the question. – None – 2011-03-10T12:22:35.783

@pooh : um, that's the menu tree of Firefox. I've never used Firefox on Linux before, does it not have similar menu? – pepoluan – 2011-03-10T12:27:12.223

@Arjan: You got me wrong... I meant that i use the file:/// facility to browse local FS in firefox. Should have added "in firefox" to "browse", because that's where the original understanding was diverted. – None – 2011-03-10T12:53:26.280

@pooh : I see... I'll edit my answer – pepoluan – 2011-03-10T13:22:52.533

@pepoluan: I think the menu tree is the same, but invoked from Edit→Preferences→Applications tab. I'll try to modify this rdf thingy but it's scary i must admit. – None – 2011-03-10T13:28:42.600

@pooh : true, it's scary. I myself can't help you with that file. Just be careful... – pepoluan – 2011-03-10T13:33:13.663

According to http://kb.mozillazine.org/MimeTypes.rdf: In general, it is not advisable to edit this file manually because of its complexity and the fact that interfaces are provided to edit it in Firefox

– Arjan – 2011-03-10T13:53:49.960

@Arjan : indeed. But I don't think the Edit/Preferences/Applications dialog provides a way to add new MIMEtypes. At least, not in Windows. – pepoluan – 2011-03-10T14:03:36.493

@pepoluan: Nor in Linux. – None – 2011-03-10T14:56:58.300

1

Daniel Hilgarth

Posted 2011-03-10T10:30:16.530

Reputation: 197

@DanielHilgarth Even if the link answers the question in full, the link could unfortunately be broken tomorrow (and the information would be lost as far as superuser.com is concerned). Editing a few steps into your answer isn't going to break copyright laws (which aren't about instructions/steps/ideas, but rather creative expression). Alternatively, you could summarize the link (if the summary said the needed info.) – Brōtsyorfuzthrāx – 2017-09-06T03:01:31.087

@Daniel Hilgarth: Thank You! This i've found, but the thing i want to achieve is slightly different: when i for example browse local file system, and click on a text file, it's being opened by default in a firefox browser. I need to change this behaviour so it's being opened in my editor instead. – None – 2011-03-10T11:44:38.123

1If normal text files are opened in firefox, your extension associations are really messed up. Just right click on the file and choose open with and choose the correct program and check the checkbox to always open that file type with that new program. – Daniel Hilgarth – 2011-03-10T11:47:31.630

@pooh, that is totally different from what you asked! But now, as there are two answers already, I feel it's too late to fix your question. If Daniel's comment does not work for you, then Why can't change the default program to open an extension in Windows 7? might help. Also, next time please indicate what you already tried.

– Arjan – 2011-03-10T12:17:35.173

1

(@Daniel, though I see you're not new on SOFU, please see Are answers that just contain links elsewhere really “good answers”?. Thanks!)

– Arjan – 2011-03-10T12:19:52.003

@Arjan: Sorry, English is not my native language, could have been the root of misunderstanding. I don't understand why it's different... I'll try to update the question though. – None – 2011-03-10T12:23:45.437

@Arjan: I know, but the link I provided answered exactly his question. He didn't have to extract the information relevant to him from an article on a broader subject. IMHO, in this case, it is ok to just post the link. – Daniel Hilgarth – 2011-03-10T12:24:00.383

@Pooh, please DO NOT change the question. That would make the existing answers useless! – Arjan – 2011-03-10T12:30:51.293

@Arjan: I think it is ok now. He left the original question as it was and added more info. Now it is clear what is meant and the answer from @pepoluan is the correct one. – Daniel Hilgarth – 2011-03-10T12:46:38.543

@Arjan: If my words were hard to understand, the question itself is useless albeit the answers are useful. Somehow i hadn't been understood correctly, it's my fault. I've tried to clarify what i need. And yes, the fact that i haven't said it's linux altered people's way of thinking. I can see it clearly now from Daniel's and yours comments... – None – 2011-03-10T12:47:37.437

Okay, I misunderstood your first comment, not your original question, @Pooh :-) (I thought your comment indicated that you were not even using Firefox to go through your local files. So: I understood that Firefox was started when you clicked on a text file in some file browser.) Sorry for making things worse! – Arjan – 2011-03-10T12:52:47.747

@Daniel Hilgarth: Maybe the answer is correct, but it doesn't help:) I don't have the bindings to text files there. Actually there are only 7 bindings (irc, ircs, mailto, Podcast, Video Podcast, webcal, Web Feed). On windows i see the whole lot of them, so i think the way of handling this is different between linux and windows. – None – 2011-03-10T13:01:17.180

@Arjan: Now as we understand (i hope) the problem it would be good to move to a next step:) From what i've found while delving for the solution... Well, actually i surmise it's impossible, but maybe someone has insights... People resort to opening the file in a default way (in the internal editor) and then view source with external editor, the method that Daniel offered. – None – 2011-03-10T13:17:14.870

1

I think the main problem is, that your application list only contains a few types. While searching for an answer, I found this thread: https://bbs.archlinux.org/viewtopic.php?pid=350900. If I understand it correctly, firefox uses gnome to get the applications list with the help of some .gconf file that is in your home directory. Maybe this hint helps you find the solution.

– Daniel Hilgarth – 2011-03-10T13:49:27.760

@Pooh, I doubt this can be easily changed. A web browser usually relies on the Content Type as sent by a web server (either in the HTTP header, or as <meta> tags) to determine the type. On your local file system, I must use other ways to achieve the same. On Windows, such is based on file extensions. On Linux and Macs, this could use the magic file number, or from analysis such as used by the file command. I doubt the developers of a browser really put a lot of time in handling local files. But maybe pepoluan's mimeTypes.rdf fixes that indeed. – Arjan – 2011-03-10T13:51:44.547

@Daniel Hilgarth: Thank You! Unfortunately for me (at least in this case) i don't use Gnome... I shall check the behavior at home though, there's gnome installed. – None – 2011-03-10T14:59:35.670

@pooh: According to the link, not using gnome might be the root of the problem. But I am just guessing here, I am a Windows guy... – Daniel Hilgarth – 2011-03-10T15:01:51.773

@Arjan: I agree. I've asked local system's maintainers to provide a mime-type (text/plain) with the file. But i'm afraid that with text/plain firefox shall nevertheless decide to view it in the internal browser. – None – 2011-03-10T15:01:58.823

@Daniel Hilgarth: Yes, i've checked now at home, here i still have gnome installed and i have a whole lot of file types in that dialog. I'll try to copy the RDF entry… – None – 2011-03-10T20:33:14.780