GNOME Bugzilla – Bug 81615
nautilus .html files are shown in text format.
Last modified: 2004-12-22 21:47:04 UTC
Using Build of 10th may. Logging in as new user in Gnome 2.0 If you try to open a local .html file in nautilus, it opens up that file as a text file. i.e. it would show <head> <body> kind of stuff too. Is it possible to make "gtkhtml" as default application to open html pages in nautilus.
*** Bug 81083 has been marked as a duplicate of this bug. ***
I'm not sure if this change was done on purpose or not, but personally considering the buggyness of gtkhml in general and the gtkhtml view, I actually prefer that nautilus doesn't use this as the default view. Pehaps the gtkhtml view shouldn't even ship, since it's even not maintained i believe.
Damon: can you take a look at this ASAP? Thanks. Sun considers it very important (though I, personally, tend to agree with Dave that that's what a web browser is for :)
Do you have the nautilus-gtkhtml component installed? It is a separate module in cvs, and is an optional part of Nautilus. I have it installed and can view html files just fine.
Damon: does it default to viewing .html files as html? Trying this here crashes everything :/
Agree that this is the purpose of a fully-fledged browser. What seems incorrect is that html files are opened as text files by default, with the option to "view as GtkHTML" (which is meaningless to most users). It is also a poor option to provide to users if everyone is agreed that GtkHTML is buggy and can't adequately follow links in the html file (such as external web pages with cgi or javascript, or mailtos) It would be better to (in the absence of Mozilla on gtk2): - remove all pretensions of browsing from Nautilus (including not allowing http:// to be typed in the location bar) - remove GtkHTML as a viewer - set the mime types for html files to invoke a proper browser.
Well I agree with john, nautilus-gtkhtml2 should not ship with gnome2 however, this is not a nautilus issue as gtkhtml2 isn't maintained by nautilus, it's part of the unmaintained gtkhtml2 package :) One problem with not allowing http:// urls is i believe nautilus uses these for webdav (please correct me if i'm wrong)
Oh yes, I had to set up the 'View As' options to get it to use nautilus-gtkhtml by default. I agree nautilus-gtkhtml shouldn't be the default view, and it isn't so that is OK. So we should invoke a web browser to view HTML pages. I think Nautilus uses the Gnome MIME types as well as its own configuration settings for which views to show/use, so it may be a little complicated. Hopefully Alex knows how to fix it ;)
I don't know if we can set launch an external browser when viewing uri's like that. I'm not sure how this works.
I've tried changing the default_action_type to application, in the MIME types file, but that doesn't seem to be working yet. (the MIME file is installed into $prefix/share/mime-info/gnome-vfs.keys look for the text/html entry.) I was hoping that it would use one of the default web views instead (mozilla,netscape,galeon). But it still used the text view component.
if i right click on an html file, then go to open with -> other application... then select galeon, and choose edit, and select "use as default for html files" then done, then double click on the html file, it works fine. so you need to tweak the defaults in gnome-mime-data/gnome-vfs.applications to do what you want.
Ah, the above change does seem to work. I had some user-settings in ~/.gnome/mime-info that were overriding the defaults. So we just need to change the 'default_action_type' to 'application'. I'll just recheck that and then add a patch.
Created attachment 8472 [details] [review] Patch to run a web browser for html files by default, rather than use the text component
IMO this patch should be reverted once we have a functioning html view.
damon - your patch looks decently ok. however, i'd like to go a step further in this, and make the 'default applications properties' configure the gnome-vfs html handler (see bug #71632, bug #78037). i have the 'default editor' now setting the mime types stuff - porting the browser tab to this would be trivial. if you want, you can hand this bug off to me, and i'd include your patch with that.
Damon, Jacob: have you discussed this further?
Alex was looking into writing a component based on gtkhtml, but it isn't ready yet. The plan now is to: o Update gnome-vfs so if there are no components available it will use an application. o Remove the text component from the text/html .keys section. This way it will still work with GNOME 1.4 / Nautilus 1.4, i.e. the mozilla component will still be the default. And for GNOME 2 we'll be using a web browser for now. I'll look into fixing this.
taking myself off as damon's working on this
Just noticed this thread - some comments IMO nautilus-gtkhtml-2 works just right as a webpage VIEWER ie: it loads quickly and just shows the web-page So I would be concerned if it was removed. Personally I like the current behaviour where a page loads in gtkhtml quickly with buttons offering open in galeon,mozilla etc (although last I looked the galeon selection seemed borked)
My only complaint about including nautilus-gtkhtml2 is that it is buggy and unmaintained. Basically this leads to a lot of crasher bugs that no one looks at. I don't think we should be shipping really borked code for functionality that is well covered by other programs , ie mozilla. Anyway i think once galeon2 is released that nautilus-gtkhtml2 should be dropped all together. If people want to use a web view in nautilus it should be galeon. Since the galeon view will be well maintained a featureful.
So I had a look at this and removing the text component from the list of components has no effect. It will also search for components that can handle text/* and will still find the text component. So we are now back to my patch above (8472) that changes the default action to 'application'. Alex has approved this, but we are now frozen, so I can't commit it yet.
*** Bug 84000 has been marked as a duplicate of this bug. ***
jacob, about your comment on 2002-05-14 16:11: I cannot reproduce this with my build today. I have an HTML desktop entry that contains: [Desktop Entry] Version=1 Encoding=UTF-8 Name=PT-1.html Type=Link URL=http://www.ibiblio.org/Bahai/Texts/EN/PT/PT-1.html Name[en_US]=Paris Talks.html I right-click on the icon, Open with --> An Application -> Yes. In "Program to run", I put mozilla. I don't see the "Edit" option either in the "Edit file type" dialog or in the icon's context menu. I don't see a place to set the default HTML handler. Hmm. On further exploration, it looks like you must have been tweaking this stuff by opening a HTML file within a Nautilus window, rather than through the desktop UI. This points up some usability problems. There isn't consistency between the options that are accessible from the desktop and the Nautilus windows. Still, through the Nautilus window, I open my Desktop directory, and open the HTML pointer. This shows http://www.ibiblio.org/Bahai/Texts/EN/PT/PT-1.html in the location bar and has GtkHTML in the "View as" selection. This is happening, even though in "View as" dialog I have removed "View as GtkHTML" and "View as Text" from the menu. Also, in the "View as" -> "Go there" -> "Edit file type" dialog, I selected Mozilla as the default action. Clicking on that desktop link still opens the web site with GtkHTML. The "Program to run" inputbox is disabled, so I am left with only the options listed in "Default action." Okay, I see that if I click on a "real" HTML file, rather than a URL link dragged from Mozilla onto the desktop, it now opens Mozilla. Is there a way for me to also get these URL shortcuts to work? I agree that if a real browser is present, we should not display HTML inside of a Nautilus window. At least, not unless there is a working mozilla embedded rendering engine.
*** Bug 85238 has been marked as a duplicate of this bug. ***
I've applied my patch to change the default action to application. Miles: you might want to open other bugs for your specific problems. There does seem to be some inconsistency there.