MozillaZine

Replacing DHTML Menus with XUL

Monday April 5th, 2004

Nigel McFarlane writes in with news about his latest article on using XUL rather than DHTML to create Web page menus: "I've written another article highlighting the features of Mozilla. To the best of my knowledge this is the first 'dirty XUL trick' that might appeal to web developers. It's nice to see that the Mozilla styling and layout systems are robust enough to support this kind of fiddling. It would be wonderful to see a full Web toolkit of XBL objects spring up to replace the junk we do in Dynamic HTML."


#1 Let me get this straight

by MvD

Tuesday April 6th, 2004 12:21 AM

Reply to this message

So these XUL menus will only work in gecko, right? Isn't this like MSHTML? Aren't we going away from web standards? Or this a new feature that we as such we cannot implement due to MS not developing the IE engine for open standards?

#5 Re: Let me get this straight

by leafdigital

Tuesday April 6th, 2004 2:10 AM

Reply to this message

Yes, they only work in Gecko. Yes, it is like MSHTML. Yes, using these in public Web pages would be going away from Web standards. XUL is not a W3C standard.

Personally I feel the use of XUL on the Web is in general a bad idea for several reasons.

* It encourages the old two-browser thinking: ok, so you can do your IE interface extensions using ActiveX or whatever... second, you can do your Gecko interface extensions using XUL... third, you can do your standards-compliant version... but oh wait, there's only the budget for maintaining and testing two versions, so let's ditch that.

* It complicates Web page interfaces. Web pages work in a way that's easy to understand because they are so limited. There are a handful of basic form controls; you move between pages by clicking on links and submitting forms. That's it. Once a user has mastered that, they've mastered the Web. Complicating Web applications by the use of XUL can throw away this advantage of Web-based applications, making it into something that should have had a specialised client anyway. (Of course there's nothing to stop you using XUL to implement client applications...) The key reason why Web pages are so flexible - they're easy to search, easy to integrate into other things (for example, I can link directly to a page about a specific book on amazon.com, which I couldn't do if Amazon ran a specific client application), easy to translate, easy to make accessible for those with disabilities, easy to repurpose... - is that the format is, at its heart, a simple document format. With simplicity comes power. When you start making Web pages into 'applications' in their own right (rather than, as at amazon.com, documents that represent a server-side application) you start to lose both simplicity and this flexibility.

Of course putting an XUL dropdown menu into your page is not going to stop it having all those advantages :) It will suck, because dropdown menus on web pages do always suck, but that's the limit of it. However, you could view it as the beginning of a slippery slope... I would hate to see a world in which every Web site (amazon.com, bn.com, mozillazine.org...) became its own little application, all of which we had to learn individually.

--sam

#6 Re: Re: Let me get this straight

by jgraham

Tuesday April 6th, 2004 3:14 AM

Reply to this message

> I would hate to see a world in which every Web site (amazon.com, bn.com, mozillazine.org...) became its own little application, all of which we had to learn individually.

So you hate the world then?

#18 Re: Let me get this straight

by miken32

Friday April 9th, 2004 1:10 PM

Reply to this message

I think the power of XUL lies in internal stuff; company intranet sites and things like that, where you can control your client's software. Combine XUL with PHP and a database like mySQL and you've got a very powerful interface to your corporate data. But XUL should never show up on a public web site, because you know that only 10% (I'm being optimistic here) of the general public is going to be able to see it.

#2 Mozilla only?

by jeti

Tuesday April 6th, 2004 12:23 AM

Reply to this message

Are there any browsers besides Mozilla that support XUL? Do any browsers not based on Gecko support XUL?

In howfar is XUL a standard?

#3 Open XUL Alliance - A Rich Internet For Everyone

by geraldb

Tuesday April 6th, 2004 12:47 AM

Reply to this message

> Are there any browsers besides Mozilla that support XUL? Do any browsers not based on Gecko support XUL?

I invite you to stop by at the Open XUL Alliance site to see more browsers/runtimes/players that try to support Mozilla XUL or various other XUL dialects. See <http://xul.sourceforge.net> for details.

#16 Re: Open XUL Alliance - A Rich Internet For Everyo

by thelem

Tuesday April 6th, 2004 4:06 PM

Reply to this message

Beware that gerald does not use the word XUL in the way most mozilla developers use the word XUL (and I think mozilla.org have asked him to change the name of his site).

Mozilla dev's XUL = the language that the mozilla interface is written in. Gerald's XUL = any xml-based user interface language.

#4 Re: Mozilla only?

by jgraham

Tuesday April 6th, 2004 1:39 AM

Reply to this message

You culd try distributing the gecko activeX control as a plugin so that MSIE could render XUL. However, in general, only gecko-based browsers support XUL. Therefore XUL cannot be used to provide the /only/ interface for a public web site or web service. However this technique is sutiable:

1) For providing an enhanced interface for XUL-capable browsers. Sites like hotmail and yahoo already use IE-specific functionality to 'enchance' their user experience. There's no reason that sites can't make use of the more powerful features avaliable from gecko to do the same thing.

2) Intranets. If your organisation has standardised on gecko based browsers, there could be great benefits in using XUL for internal applications since you get a Real User Interface for the same cost as hackiing together an interface with HTML. Personally I think this benefit needs to be sold to more people.

3) Providing a differentt interface to different browsers. One can imagine writing a basic all-html version of a page and a sophisticated all-XUL version of a page and providing people wth only the version that they can use.

#8 Re: Mozilla only?

by WillyWonka

Tuesday April 6th, 2004 4:43 AM

Reply to this message

"Are there any browsers besides Mozilla that support XUL?"

FireFox

"Do any browsers not based on Gecko support XUL?"

I haven't seen any.

"In howfar is XUL a standard?"

It's not. As far as I know there wasn't a user interface language that was defined by the w3c when mozilla was started which was platform independent so they had to write their own. The w3c may have since defined one, I'm not sure.

#12 Re: Mozilla only?

by Waldo_2

Tuesday April 6th, 2004 7:39 AM

Reply to this message

I think Safari supports a little of it, but I've never used it. Check Dave Hyatt's weblog if you want to find out for sure.

#7 better use css than dhtml or xul on public webpage

by cybot

Tuesday April 6th, 2004 3:53 AM

Reply to this message

imho, the best way for creating dynamic menus is to use css on public web-pages, and not xul or dhtml!

#9 Re: better use css than dhtml or xul on public web

by imforumman

Tuesday April 6th, 2004 4:53 AM

Reply to this message

Amen brother! W3C standards all the way!

#10 Re: better use css than dhtml or xul on public web

by jgraham

Tuesday April 6th, 2004 5:13 AM

Reply to this message

Whilst I agree that practically they are often the best solution, in reality, CSS based menus often suck:

They have to react to hovers rather than clicks

They are fragile to use (move the mouse away from the menu and it closes)

They tend to expose browser bugs

Whilst it's nice that CSS can be hacked into a providing a solution, it's not really designed to provide UI elements. That's why people are looking at standardising bits of XUL (or at least brining XUL-like features to a standard) [1] so there is a cross-browser solution that is designed to produce GUI elements that designers are actually using.

[1] See, for example <http://ln.hixie.ch/?start=1080506019&count=1>

#13 Re: Re: better use css than dhtml or xul on public

by bzbarsky

Tuesday April 6th, 2004 9:56 AM

Reply to this message

> They have to react to hovers rather than clicks

Not true in browsers that implement :target

#15 Re: Re: Re: better use css than dhtml or xul on pu

by jgraham

Tuesday April 6th, 2004 1:23 PM

Reply to this message

Like this : <http://www-jcsu.jesus.cam…307/test/popup-demo.xhtml> ?

What I can't see is a way to make the menus disappear if you click on the body without using javascript. With the ability to do that, this technique would be great, without the ability to do that, it's at least as user-unfriendly as the hover menus.

#11 Repeating the past?

by sremick

Tuesday April 6th, 2004 6:08 AM

Reply to this message

If this is gecko-specific, and not based upon W3C standards, then I have to be against this, even though it's from Mozilla. If we encourage behavior like this, then we are no better than our enemy. The mission isn't to move people from Microsoft at any cost. The mission is to support web standards. We don't beat Microsoft by mimicing their behavior, which we've spent so many years condemning. Otherwise people label us as hypocrites, and ignore us.

If it's done using a W3C standard and it happens that gecko is the only browser that supports it, then that's ok.

#17 Re: Repeating the past?

by danielwang <stolenclover@yahoo.com.tw>

Tuesday April 6th, 2004 6:59 PM

Reply to this message

It shouldn't be too complicated to emulate XUL syntax by using XBL. It will be W3C Standard-compliant (but still Gecko-only :-( )

#14 I like CSS Menus

by skeeter

Tuesday April 6th, 2004 11:02 AM

Reply to this message

#19 Re: I like CSS Menus

by bjherbison <bj@herbison.com>

Tuesday April 13th, 2004 7:48 AM

Reply to this message

> What's wrong with hover pop ups?

Well, for starters there are accessibility issues. Hover pop-up menus are hard to use by people who have poor mouse control or can't use a mouse. Someone with shaky hands would get very frustrated using your CSS menu example, and I couldn't find any way to expand the menus from the keyboard.

Aside from the rudeness of excluding some people, some web developers have legal requirements to make their site accessible (e.g., US Government section 508 requirements).