viewing HS files in Firefox

When I try to go to one of the Module.hs files, e.g. on darcs.haskell.org, it now has type HS and Firefox refuses to display it (and only lets me download it). Does anyone know how to make Firefox treat certain file types as others (HS as plain text, in particular)? so that I can browse them with any convenience Thanks, Isaac

On 27/10/2007, Isaac Dupree
When I try to go to one of the Module.hs files, e.g. on darcs.haskell.org, it now has type HS and Firefox refuses to display it (and only lets me download it). Does anyone know how to make Firefox treat certain file types as others (HS as plain text, in particular)? so that I can browse them with any convenience
I've looked into this before but haven't found a satisfactory answer. At best, you can get the offending MIME types to open in a third party text viewer. But I don't know how to force the internal text viewer. Actually, a thought occurs. The address bar prefix view-source: works for html. As in, "http://www.haskell.org" -> "view-source:http://www.haskell.org". This might be an effective workaround though I don't have a page to test it on right now. Cheers, D.

Dougal Stanton wrote:
On 27/10/2007, Isaac Dupree
wrote: When I try to go to one of the Module.hs files, e.g. on darcs.haskell.org, it now has type HS and Firefox refuses to display it (and only lets me download it). Does anyone know how to make Firefox treat certain file types as others (HS as plain text, in particular)? so that I can browse them with any convenience
I've looked into this before but haven't found a satisfactory answer. At best, you can get the offending MIME types to open in a third party text viewer. But I don't know how to force the internal text viewer.
Actually, a thought occurs. The address bar prefix view-source: works for html. As in, "http://www.haskell.org" -> "view-source:http://www.haskell.org". This might be an effective workaround though I don't have a page to test it on right now.
hmm, taking http://darcs.haskell.org/ghc-6.6/packages/base/Data/Map.hs that works, but it's rather inconvenient to convince Firefox to put the URL into the address bar so I can type view-source in front. I had to use "copy link location", make a new tab, and paste into the empty address bar (unless there's some way I didn't find) ISaac

On Sat, 2007-10-27 at 18:48 -0400, Isaac Dupree wrote:
When I try to go to one of the Module.hs files, e.g. on darcs.haskell.org, it now has type HS and Firefox refuses to display it (and only lets me download it). Does anyone know how to make Firefox treat certain file types as others (HS as plain text, in particular)? so that I can browse them with any convenience
I believe those kinds of problem have to do with the MIME-encoding on the server side: The server uses text/x-haskell. For Firefox to display the document inline it probably has to be text/plain. Not sure what the proper fix is, though. / Thomas

The "Open in Browser" Firefox extension -- quite possibly the handiest thing since hoogle as a custom search engine plugin (if not handier!) http://www.spasche.net/mozilla/ --S On Oct 27, 2007, at 8:16 PM, Thomas Schilling wrote:
On Sat, 2007-10-27 at 18:48 -0400, Isaac Dupree wrote:
When I try to go to one of the Module.hs files, e.g. on darcs.haskell.org, it now has type HS and Firefox refuses to display it (and only lets me download it). Does anyone know how to make Firefox treat certain file types as others (HS as plain text, in particular)? so that I can browse them with any convenience
I believe those kinds of problem have to do with the MIME-encoding on the server side: The server uses text/x-haskell. For Firefox to display the document inline it probably has to be text/plain. Not sure what the proper fix is, though.
/ Thomas
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Thomas Schilling wrote:
Isaac Dupree wrote:
When I try to go to one of the Module.hs files, e.g. on darcs.haskell.org, it now has type HS and Firefox refuses to display it (and only lets me download it). Does anyone know how to make Firefox treat certain file types as others (HS as plain text, in particular)? so that I can browse them with any convenience
I believe those kinds of problem have to do with the MIME-encoding on the server side: The server uses text/x-haskell. For Firefox to display the document inline it probably has to be text/plain. Not sure what the proper fix is, though.
I think so, too. Isn't there a way to reassign MIME types to browser/plugins via some hidden preferences in Firefox/Camino? On MacOS 9, the old Netscape 4.5 allowed me to do that. I believe that Internet Explorer could do that as well via a standard system-wide preference. Regards, apfelmus

Thomas Schilling wrote:
On Sat, 2007-10-27 at 18:48 -0400, Isaac Dupree wrote:
When I try to go to one of the Module.hs files, e.g. on darcs.haskell.org, it now has type HS and Firefox refuses to display it (and only lets me download it). Does anyone know how to make Firefox treat certain file types as others (HS as plain text, in particular)? so that I can browse them with any convenience
I believe those kinds of problem have to do with the MIME-encoding on the server side: The server uses text/x-haskell. For Firefox to display the document inline it probably has to be text/plain. Not sure what the proper fix is, though.
It should probably be fixed in one of the Apache config files. In the HTTP headers from darcs.haskell.org (viewed with the Live HTTP headers extension in FireFox) I'm getting Server: Apache/2.2.3 (Debian) Content-Type: text/x-haskell returned when I request the Map.hs file. For Apache 2.2 there seem to be various solutions. The web admin should probably be looking at these sorts of things http://httpd.apache.org/docs/2.2/mod/mod_mime.html#addtype http://httpd.apache.org/docs/2.2/mod/core.html#forcetype http://httpd.apache.org/docs/2.2/mod/core.html#defaulttype and maybe rummaging in file httpd.conf Richard.

When I try to go to one of the Module.hs files, e.g. on darcs.haskell.org, it now has type HS and Firefox refuses to display it (and only lets me download it). Does anyone know how to make Firefox treat certain file types as others (HS as plain text, in particular)? so that I can browse them with any convenience
In Windows what I do is save the file on the desktop when it asks you to save it. Then right-click the file and select "open with" and choose "wordpad" to open it with. Check the box "open with this application every time". Now close it and go back to your browser and click on the file. It should now open up in wordpad each time. At least that is the behavior in IE.
Thanks, Isaac
Tim Newsham http://www.thenewsh.com/~newsham/

I would love an answer to this as well.
Isaac Dupree

Isaac Dupree wrote:
When I try to go to one of the Module.hs files, e.g. on darcs.haskell.org, it now has type HS and Firefox refuses to display it (and only lets me download it). Does anyone know how to make Firefox treat certain file types as others (HS as plain text, in particular)? so that I can browse them with any convenience
It is really annoying, and it is an astoundingly old bug in firefox. Apparently it's very hard to fix due to annoying details of the firefox architecture. It would be simplest for everyone if haskell.org was prepared to send out the files as text/plain (even though this is the wrong mime type), as I believe it used to do. The browser plugins can help, though. Jules

Jules Bean wrote:
Isaac Dupree wrote:
When I try to go to one of the Module.hs files, e.g. on darcs.haskell.org, it now has type HS and Firefox refuses to display it (and only lets me download it). Does anyone know how to make Firefox treat certain file types as others (HS as plain text, in particular)? so that I can browse them with any convenience
It is really annoying, and it is an astoundingly old bug in firefox. Apparently it's very hard to fix due to annoying details of the firefox architecture.
It would be simplest for everyone if haskell.org was prepared to send out the files as text/plain (even though this is the wrong mime type), as I believe it used to do. ...
Yes, it does appear to be a bug in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=57342 not to attempt to display text/x-haskell as if it were text/plain, but to get really obsessive I'm not convinced text/plain is strictly speaking the 'wrong' media-type if that's what the user-agent requests. For example, my FireFox 1.5.0.5 says to the server it will Accept these media-types text/xml, application/xml, application/xhtml+xml, text/html; q=0.9, text/plain; q=0.8, image/png,*/*; q=0.5 This is in order of what it would most like to get back from the server. The server then goes off and tries to find the best media-type for my browser - it can supply different ones depending on what the browser says it wants. By returning it as text/x-haskell the server has given the resource to my browser in */* which is the least wanted media-type. This is perfectly correct behaviour, but if the server was also capable of providing the same thing as text/plain it would be better to give this, or even better a pretty coloured text/html one if the server had one available. I think the underlying file returned as text/x-haskell or text/plain can be the exact same file assuming all x-haskell are also plain. Could be wrong, but that's my understanding of content negotiation. Richard.

Adding the following to my lighttpd config (on Ubuntu Feisty) solves the problem from the server side: #### external configuration files ## mimetype mapping # change mime type for haskell source files so they get displayed # inside the browser include_shell "/usr/share/lighttpd/create-mime.assign.pl" mimetype.assign += ( ".hs" => "text/plain", ".lhs" => "text/plain" ) -- Johan

Johan Tibell wrote:
Adding the following to my lighttpd config (on Ubuntu Feisty) solves the problem from the server side:
#### external configuration files ## mimetype mapping
# change mime type for haskell source files so they get displayed # inside the browser include_shell "/usr/share/lighttpd/create-mime.assign.pl" mimetype.assign += ( ".hs" => "text/plain", ".lhs" => "text/plain" )
Fortunately the new haddock uses hscolour, so HS files are served as (colourised!) HTML and the problem is no longer a problem, for me. Jules

On Jan 10, 2008 1:55 PM, Jules Bean
Johan Tibell wrote:
Adding the following to my lighttpd config (on Ubuntu Feisty) solves the problem from the server side:
#### external configuration files ## mimetype mapping
# change mime type for haskell source files so they get displayed # inside the browser include_shell "/usr/share/lighttpd/create-mime.assign.pl" mimetype.assign += ( ".hs" => "text/plain", ".lhs" => "text/plain" )
Fortunately the new haddock uses hscolour, so HS files are served as (colourised!) HTML and the problem is no longer a problem, for me.
Jules
My problem is when viewing plain darcs repositories (like mine on darcs.johantibell.com which I recently fixed with the above mime type hack.) -- Johan

My problem is when viewing plain darcs repositories (like mine on darcs.johantibell.com which I recently fixed with the above mime type hack.)
Please complain to your browser('s authors): most browsers only provide *one* way to view a given mime-type, which is stupid. It's not specific to .hs files. They could at least provide a way to override the provided mime-type, so you can say "display this application/octet-stream file as a text/plain". Similarly they should allow you to choose (via a context-menu, for example) to open a pdf file in the pdf plugin or in a separate application. Stefan

Stefan Monnier
My problem is when viewing plain darcs repositories (like mine on darcs.johantibell.com which I recently fixed with the above mime type hack.)
Please complain to your browser('s authors): most browsers only provide *one* way to view a given mime-type, which is stupid. It's not specific to .hs files.
They could at least provide a way to override the provided mime-type, so you can say "display this application/octet-stream file as a text/plain". Similarly they should allow you to choose (via a context-menu, for example) to open a pdf file in the pdf plugin or in a separate application.
Konqueror offers: - mime default actions - opening path/index.html if pointed to path/ or path when operating locally - for any hyperlink: - save link as - copy link address - open with <-- - preview with <-- ...as it does offer copy, move, open with and preview with for any file in directory mode. Kpdf and likewise also nicely integrate their own buttons into the toolbar, replacing the khtmlpart zoom ones and so on. Vastly underestimated this thing is. -- (c) this sig last receiving data processing entity. Inspect headers for past copyright information. All rights reserved. Unauthorised copying, hiring, renting, public performance and/or broadcasting of this signature prohibited.

On Thu, Jan 10, 2008 at 10:07:25AM -0500, Stefan Monnier wrote:
My problem is when viewing plain darcs repositories (like mine on darcs.johantibell.com which I recently fixed with the above mime type hack.)
Please complain to your browser('s authors): most browsers only provide *one* way to view a given mime-type, which is stupid. It's not specific to .hs files.
This extension allows this in firefox. it gives you an 'open in browser as' option that lets you view links in a variety of ways rather than being forced to download it. http://www.spasche.net/mozilla/ John -- John Meacham - ⑆repetae.net⑆john⑈
participants (13)
-
Achim Schneider
-
apfelmus
-
Dougal Stanton
-
Isaac Dupree
-
Johan Tibell
-
John Meacham
-
Jules Bean
-
Richard Kelsall
-
Stefan Monnier
-
Sterling Clover
-
Thomas Hartman
-
Thomas Schilling
-
Tim Newsham