We're so used to the big-buttons user interface of Mozilla that driving the Mozilla browser or the platform by
any other means seems odd, at least. The trouble is that those big buttons don't offer much flexibility. With this quick guide to Mozilla tools, you'll discover how to get more out of Mozilla Application Suite on enterprise Linux.
The Mozilla Application Suite includes the releases of Mozilla that contain the browser, e-mail, composer and other apps. The latest release is 1.6. You can find the same functionality in the standalone browser and e-mailer, except the menu options and file names are slightly different. Every Mozilla application contains the Mozilla platform.
First, you can drive the platform from the command line. To stop the platform from displaying the browser (the default), use the "-chrome" option (try "mozilla -help", one minus only). That means using this syntax:
mozilla -chrome URL
It does not include:
The URL part can be modified. Mozilla supports the "resource:" and the "chrome:" URL schemes as well as "http:", "ftp:", "file:" and "email:".
The "resource:" scheme is like "file:", except it is relative to the top of the Mozilla install area; that's usually the same as "$MOZILLA_FIVE_HOME" or "dirname 'type mozilla'". The "chrome:" scheme usually maps to the "resource:/chrome" directory, but it really describes a specific application that has been registered with the platform. So "mozilla -chrome chrome://navigator/content/navigator.xul" is the same as plain "mozilla".
Recall that "Navigator" is the old name for the Netscape browser. You can also strip the browser away from plain HTML:
mozilla -chrome file:///tmp/test.html
Try these all out. Every window that can be displayed from the standard set of menus can also be displayed from the command line using "some chrome: URL". As a final eye-stretching test, try:
Note that the "-chrome" option is missing, so this command displays the browser window inside, well, another browser window. Examine the weird window that results: Both nested browsers still work.
Mozilla also supports .jar files. These are in pkzip format, which can be read with the Unix tools unzip/zip (not gunzip/gzip). The chrome area is full of .jar files, because they're a convenient and space-saving way to package a Mozilla application. Be aware that the order of files in such .jar archives is sometimes important and shouldn't be changed. There's no Java at work here, by the way. Mozilla supports the "jar:" scheme for viewing files in .jar archives, but you can't use that from the command line for security reasons. It's easier to copy those files to /tmp and unpack them yourself with unzip. Use any text editor to view all files that aren't images.
The DOM Inspector lays open the content and layout of an XML document. From the Inspector, choose "File|Inspect a window" and pick any Mozilla window currently open. Down on the left-hand side of the Inspector, the full XML hierarchy of that window is displayed, both XUL and HTML.
After the document containing the script loads and that line of code is reached, the debugger is started. Use the big buttons at the top of the debugger to continue loading the page from that point on.
There's a great deal to explore in Mozilla, and this article just scratches the surface. Have a poke around in the chrome directory and see what you can find.
For more information:
Got questions about Mozilla or Web and software development? Ask Nigel McFarlane.
Find out about differences between Mozilla on Windows and Linux.