[opensuse] Firefox - how to get it to open c source file as a text file in firefox??
List, Firefox is outsmarting itself again. I want to open a simple text file (c++ source file) named mycols.cc. When I click on it in Firefox, it asks me to open in emacs, or save, etc. If I set the helper application for c++ files to firefox, firefox blows up trying to open the file when it goes into a loop and tries to open 1000 tabs. So, what's the trick? Wolfgang? -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 2009/03/25 09:18 (GMT-0500) David C. Rankin composed:
Firefox is outsmarting itself again. I want to open a simple text file (c++ source file) named mycols.cc. When I click on it in Firefox, it asks me to open in emacs, or save, etc. If I set the helper application for c++ files to firefox, firefox blows up trying to open the file when it goes into a loop and tries to open 1000 tabs. So, what's the trick? Wolfgang?
Workaround: give file a symlink ending in .txt or .prn or with no filename extension. The bigger question: why open in FF instead of mc or kwrite or emacs? -- "The plans of the diligent lead to profit as surely as haste leads to poverty." Proverbs 21:5 NIV Team OS/2 ** Reg. Linux User #211409 Felix Miata *** http://fm.no-ip.com/ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wednesday, 2009-03-25 at 11:36 -0400, Felix Miata wrote:
The bigger question: why open in FF instead of mc or kwrite or emacs?
Guess: because it is, after all, a text file which he wants simply to read, not edit (nor download and save to file, perhaps). Of course, a dedicated editor/viewer can add syntax colouring. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAknKWj0ACgkQtTMYHG2NR9XXigCeK8YJZVIO/l7of6tRLhASpbLm fXQAoIYAMjPqCemz3iJc2AnMlFgVNT0W =1cav -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Felix Miata wrote:
On 2009/03/25 09:18 (GMT-0500) David C. Rankin composed:
Firefox is outsmarting itself again. I want to open a simple text file (c++ source file) named mycols.cc. When I click on it in Firefox, it asks me to open in emacs, or save, etc. If I set the helper application for c++ files to firefox, firefox blows up trying to open the file when it goes into a loop and tries to open 1000 tabs. So, what's the trick? Wolfgang?
Workaround: give file a symlink ending in .txt or .prn or with no filename extension.
The bigger question: why open in FF instead of mc or kwrite or emacs?
No, No, Guys, there's no question there, I have a bunch of c & c++ files in a directory on my website. The entire /downloads directory has +indexes set just so I can browse it as a directory, just like you browse http://download.opensuse.org/repositories/openSUSE:/Tools/openSUSE_11.1/x86_... to find a specific rpm. Forget mycols.cc for the moment, and let's just focus on text files regardless of whether it's a script, source file, csv export, whatever. When I click on a text file in Firefox, it ought to display the text file in the browser windows just like all browsers have done since the dawn of NCSA Mosaic. For some reason firefox won't do this. I don't want to open the file for editing either, I just want to display it in the browser window, so I can do a quick select of the code I want, then alt+tab and middle-click insert the text into kate or vi or whatever else I may be working with at the time. For example, go to: http://www.3111skyline.com/download/ the click on the webdev directory, the look at the short text file "cp3colTemplateFiles". Firefox opens that just fine. Now click 'back' in firefox and then choose "Parent Directory" and navigate to the directory "programming/c++/apps" and then try to click on the text file "viewmod_posix.cpp" and the damn Firefox save dialog pops back up. WTF?? Why can't I look at "viewmod_posix.cpp" the same way I just looked at "cp3colTemplateFiles"??? This is what I want to fix and I can't seem to outsmart firefox to make it work. Obviously Firefox isn't using the actual 'file' information to make a decision whether to open the file or not, so I must be using some time of extension scheme. How do I tell it that for '.c*', just display the dang file. It does it for a whole host of other text files. In download/linux/ati/ there are a number for files, xorg.confs, etc. and every text file in there opens right up in the browser.... There has to be a simple fix -- or an evil conspiracy somewhere... Thanks for any help you can give. -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
David C. Rankin wrote: <snip>
Forget mycols.cc for the moment, and let's just focus on text files regardless of whether it's a script, source file, csv export, whatever. When I click on a text file in Firefox, it ought to display the text file in the browser windows just like all browsers have done since the dawn of NCSA Mosaic. For some reason firefox won't do this.
Yes, in some ways they are all text files, but the server sends different mime types for them. E.g. text/plain for text, text/x-c for C source file, etc., etc. The problem being: Firefox only displays text files which are sent with text/plain as mime type. See my other reply in this thread for the bugreports to mozilla. You could force the server to send text/plain as the mime type, but its a local fix, and an ugly one.
There has to be a simple fix -- or an evil conspiracy somewhere...
A bug that has been reported over 8 years ago. Maybe it is a conspiracy ? :-) /Sylvester -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Sylvester Lykkehus wrote:
David C. Rankin wrote: <snip>
Forget mycols.cc for the moment, and let's just focus on text files regardless of whether it's a script, source file, csv export, whatever. When I click on a text file in Firefox, it ought to display the text file in the browser windows just like all browsers have done since the dawn of NCSA Mosaic. For some reason firefox won't do this.
Yes, in some ways they are all text files, but the server sends different mime types for them. E.g. text/plain for text, text/x-c for C source file, etc., etc.
The problem being: Firefox only displays text files which are sent with text/plain as mime type. See my other reply in this thread for the bugreports to mozilla.
You could force the server to send text/plain as the mime type, but its a local fix, and an ugly one.
There has to be a simple fix -- or an evil conspiracy somewhere...
A bug that has been reported over 8 years ago. Maybe it is a conspiracy ? :-)
/Sylvester
Now the veil of fog is starting to lift. So it isn't totally firefox, it's apache managing the mime-types and Firefox is just responding to what it gets? I've chased down ~/.mozilla/firefox/(garbage)/mimeTypes.rdf and changing it is no help at all. It's like a rubber-band, change it and it snaps right back to its old behavior. I just deleted it and forced a rebuild. Oh well, I never knew viewing a text file could be so much work... Thanks again Sylvester -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Wednesday March 25 2009, David C. Rankin wrote:
...
Now the veil of fog is starting to lift. So it isn't totally firefox, it's apache managing the mime-types and Firefox is just responding to what it gets?
That is true. When the server does not specify a MIME type or when the stream comes from a local file (and hence has no HTTP header where the MIME type and other metadata would be held), it falls back on using the file name suffix to infer a MIME type for the file's contents.
I've chased down ~/.mozilla/firefox/(garbage)/mimeTypes.rdf and changing it is no help at all. It's like a rubber-band, change it and it snaps right back to its old behavior. I just deleted it and forced a rebuild. Oh well, I never knew viewing a text file could be so much work...
That's 'cause you're trampling on the programmers' domain when they went to the trouble of giving you ~/.mime.types as means of overriding the built-in (or system-supplied) file-name-suffix-to-MIME-type mappings
Thanks again Sylvester
-- David C. Rankin
Randall Schulz -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Wednesday March 25 2009, David C. Rankin wrote:
..
There has to be a simple fix -- or an evil conspiracy somewhere...
Thanks for any help you can give.
You didn't like the ~/.mime.types solution I posted?
-- David C. Rankin
Randall Schulz -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Randall R Schulz wrote:
On Wednesday March 25 2009, David C. Rankin wrote:
..
There has to be a simple fix -- or an evil conspiracy somewhere...
Thanks for any help you can give.
You didn't like the ~/.mime.types solution I posted?
That will only work when browsing local files though, but i think you also suggested that in your post. It won't work when clicking on text/* files while browsing directory indexes at a remote location, the mime type sent by the server will be used and acted upon.
-- David C. Rankin
Randall Schulz
/Sylvester -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Wednesday March 25 2009, Sylvester Lykkehus wrote:
Randall R Schulz wrote:
On Wednesday March 25 2009, David C. Rankin wrote:
..
There has to be a simple fix -- or an evil conspiracy somewhere...
Thanks for any help you can give.
You didn't like the ~/.mime.types solution I posted?
That will only work when browsing local files though, but i think you also suggested that in your post. It won't work when clicking on text/* files while browsing directory indexes at a remote location, the mime type sent by the server will be used and acted upon.
True, but David was asking about local files. At least that's how I read it: "... I want to open a simple text file ..."
/Sylvester
Randall Schulz -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
True, but David was asking about local files. At least that's how I read it: "... I want to open a simple text file ..."
I can't figure why one would want to use firefox to open a local file unless it was something the browser was good at (ie, rendering HTML)... He must mean a simple text file (arguably program source code qualifies) on a web server somewhere. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Randall R Schulz wrote:
On Wednesday March 25 2009, David C. Rankin wrote:
..
There has to be a simple fix -- or an evil conspiracy somewhere...
Thanks for any help you can give.
You didn't like the ~/.mime.types solution I posted?
-- David C. Rankin
Randall Schulz
I'm sure I'll like it, I hadn't got to it yet;-) -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 2009/03/25 13:33 (GMT-0500) David C. Rankin composed:
I have a bunch of c & c++ files in a directory on my website. The entire /downloads directory has +indexes set just so I can browse it as a directory, just like you browse http://download.opensuse.org/repositories/openSUSE:/Tools/openSUSE_11.1/x86_... to find a specific rpm.
Forget mycols.cc for the moment, and let's just focus on text files regardless of whether it's a script, source file, csv export, whatever. When I click on a text file in Firefox, it ought to display the text file in the browser windows just like all browsers have done since the dawn of NCSA Mosaic. For some reason firefox won't do this.
I don't want to open the file for editing either, I just want to display it in the browser window, so I can do a quick select of the code I want, then alt+tab and middle-click insert the text into kate or vi or whatever else I may be working with at the time.
Old problem, but since it's open source, you're welcome to provide a patch to fix it: https://bugzilla.mozilla.org/show_bug.cgi?id=57342 Why not Opera? -- "The plans of the diligent lead to profit as surely as haste leads to poverty." Proverbs 21:5 NIV Team OS/2 ** Reg. Linux User #211409 Felix Miata *** http://fm.no-ip.com/ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
David C. Rankin wrote:
No, No, Guys, there's no question there,
I have a bunch of c & c++ files in a directory on my website. The entire /downloads directory has +indexes set just so I can browse it as a directory, just like you browse http://download.opensuse.org/repositories/openSUSE:/Tools/openSUSE_11.1/x86_... to find a specific rpm.
Forget mycols.cc for the moment, and let's just focus on text files regardless of whether it's a script, source file, csv export, whatever. When I click on a text file in Firefox, it ought to display the text file in the browser windows just like all browsers have done since the dawn of NCSA Mosaic. For some reason firefox won't do this.
I don't want to open the file for editing either, I just want to display it in the browser window, so I can do a quick select of the code I want, then alt+tab and middle-click insert the text into kate or vi or whatever else I may be working with at the time.
For example, go to:
http://www.3111skyline.com/download/ the click on the webdev directory, the look at the short text file "cp3colTemplateFiles". Firefox opens that just fine.
Now click 'back' in firefox and then choose "Parent Directory" and navigate to the directory "programming/c++/apps" and then try to click on the text file "viewmod_posix.cpp" and the damn Firefox save dialog pops back up. WTF??
Why can't I look at "viewmod_posix.cpp" the same way I just looked at "cp3colTemplateFiles"??? This is what I want to fix and I can't seem to outsmart firefox to make it work.
Obviously Firefox isn't using the actual 'file' information to make a decision whether to open the file or not, so I must be using some time of extension scheme. How do I tell it that for '.c*', just display the dang file. It does it for a whole host of other text files.
In download/linux/ati/ there are a number for files, xorg.confs, etc. and every text file in there opens right up in the browser....
There has to be a simple fix -- or an evil conspiracy somewhere...
Thanks for any help you can give.
I installed the addon from the link Sylvester provided http://www.spasche.net/openinbrowser/ and used it to successfully open one of your .cpp files as a text file in the browser. That's what you're looking for isn't it. Regards Dave P -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Wednesday March 25 2009, David C. Rankin wrote:
List,
Firefox is outsmarting itself again. I want to open a simple text file (c++ source file) named mycols.cc. When I click on it in Firefox, it asks me to open in emacs, or save, etc. If I set the helper application for c++ files to firefox, firefox blows up trying to open the file when it goes into a loop and tries to open 1000 tabs. So, what's the trick? Wolfgang?
I have, from time to time, by Firefox's refusal to open a file I knew to be plain text but whose associated MIME type (explicitly indicated by the server supplying the data or inferred by Firefox based on its own notions) did not indicate that the contents were text. Reading your post brought an idea to mind. Open the URI "about:config" in your Firefox and type MIME into the filter. I see some hopeful things, namely these two: helpers.global_mime_types_file /etc/mime.types helpers.private_mime_types_file ~/.mime.types I looked at /etc/mime.types and found the suffix "cc" there associated with the MIME type "text/x-c++src": text/x-c++src cpp cxx cc C c++ So I created ~/.mime.types containing this single line: text/plain cpp cxx cc C c++ Now when I send Firefox a local file URI for a .cc file, it just opens it and displays its text. Thank you for making me think about this!
-- David C. Rankin
Randall Schulz -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wednesday, 2009-03-25 at 09:50 -0700, Randall R Schulz wrote:
Open the URI "about:config" in your Firefox and type MIME into the filter. I see some hopeful things, namely these two:
helpers.global_mime_types_file /etc/mime.types helpers.private_mime_types_file ~/.mime.types
Nice... Yep, but notice that these files are used by every mail app or webrowser. For example, if you attach a C file to an email, it will now go as text/plain to the recipient of the email. I think there is another similar file that defines what application to use for opening text/x-c++src files, and that has only a local effect... ah, yes, ".mailcap". Use that one. I don't know if firefox uses that file, though. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAknKgQYACgkQtTMYHG2NR9Ve1gCfbbedgj2szgKG15T5l3xbn/Yr CMkAoIgHcvvr19MjEmg2xtBoZ7dgsyP6 =4BNT -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Randall R Schulz wrote:
On Wednesday March 25 2009, David C. Rankin wrote:
List,
Firefox is outsmarting itself again. I want to open a simple text file (c++ source file) named mycols.cc. When I click on it in Firefox, it asks me to open in emacs, or save, etc. If I set the helper application for c++ files to firefox, firefox blows up trying to open the file when it goes into a loop and tries to open 1000 tabs. So, what's the trick? Wolfgang?
I have, from time to time, by Firefox's refusal to open a file I knew to be plain text but whose associated MIME type (explicitly indicated by the server supplying the data or inferred by Firefox based on its own notions) did not indicate that the contents were text.
Reading your post brought an idea to mind.
Open the URI "about:config" in your Firefox and type MIME into the filter. I see some hopeful things, namely these two:
helpers.global_mime_types_file /etc/mime.types helpers.private_mime_types_file ~/.mime.types
I looked at /etc/mime.types and found the suffix "cc" there associated with the MIME type "text/x-c++src":
text/x-c++src cpp cxx cc C c++
So I created ~/.mime.types containing this single line:
text/plain cpp cxx cc C c++
Now when I send Firefox a local file URI for a .cc file, it just opens it and displays its text.
Thank you for making me think about this!
Randall Schulz
Thank you for thinking about it;-) -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
David C. Rankin wrote:
List,
Firefox is outsmarting itself again. I want to open a simple text file (c++ source file) named mycols.cc. When I click on it in Firefox, it asks me to open in emacs, or save, etc. If I set the helper application for c++ files to firefox, firefox blows up trying to open the file when it goes into a loop and tries to open 1000 tabs. So, what's the trick? Wolfgang?
See this bug, which has been around since year 2000: https://bugzilla.mozilla.org/show_bug.cgi?id=57342 Also see this addon: http://www.spasche.net/openinbrowser/ /Sylvester -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (7)
-
Carlos E. R.
-
Dave Plater
-
David C. Rankin
-
Felix Miata
-
Philip Dowie
-
Randall R Schulz
-
Sylvester Lykkehus