Friday, December 08, 2006

What is XUL and Its role in Mozilla/Firefox browser

What is XUL and why was it created?

XUL is developed to make firefox/mozilla browser easily and faster.
It follows XML structure and schemantics.
Even MathML or SVG can be inserted within it.

WE can make the following elements:
* Input controls such as textboxes and checkboxes
* Toolbars with buttons or other content
* Menus on a menu bar or pop up menus
* Tabbed dialogs
* Trees for hierarchical or tabular information
* Keyboard shortcuts


The created applications can be used as :
Firefox extension
Standalone XULRunner application
XUL package
Remote XUL application

Before learning XUL u need to know the following:
XML(DOM),
HTML,
CSS,
JavaScript and latest firefox browser

You can use same CSS properties in XUL just like HTML CSS.

THe XUL can be accessed from Browser using Chrome URL.
'chrome://' Your URL -> refers installed packages and extensions.


if you are going to use XUL on a web site, you can just put the XUL file on the web site as you would an HTML file, and then load its URL in a browser. Ensure that your web server is configured to send XUL files with the content type of 'application/vnd.mozilla.xul+xml'. This content type is how Mozilla knows the difference between HTML and XUL.

Mozilla does not use the file extension, unless reading files from the file system, but you should use the .xul extension for all XUL files. You can load XUL files from your own machine by opening them in the browser, or by double-clicking the file in your file manager. Remember that remote XUL will have significant restrictions on what it can do.

Firefox uses different documents types for :HTML, XML and XUL
Naturally, the HTML document is used for HTML documents, the XUL document is used for XUL documents, and the XML document is used for other types of XML documents. Since XUL is also XML, the XUL document is a subtype of the more generic XML document.

To summarize the points made above:

* Mozilla renders both HTML and XUL using the same underlying engine and uses CSS to specify their presentation.
* XUL may be loaded from a remote site, the local file system, or installed as a package and accessed using a chrome URL. This is what browser extensions do.
* Chrome URLs may be used to access installed packages and open them with enhanced privileges.
* HTML, XML and XUL each have a different document type. Some features may be used in any document type whereas some features are specific to one kind of document.

Example of buttons:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window
id="findfile-window"
title="Find Files"
orient="horizontal"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

<button id="find-button" label="Find"/>
<button id="cancel-button" label="Cancel"/>

</window>

No comments: