Team LiB
Previous Section Next Section

Hack 10. Start Up from the Command Line

You can start Firefox without using the mouse.

How is Firefox started? This hack describes all the command-line options. To see command-line options, most technical people instinctively open a command-line window, such as an xterm (Linux) or an MS-DOS or cmd window (Windows). Then they type program /? or program --help, depending on the operating system. The latter option works everywhere except in Windows, because Firefox doesn't provide console-based help there. So Windows is a special case: help information isn't automatically spat out there. To see command-line options on Windows, you have to go further with a DOS or cmd box. On Windows, start up a command line (StartProgramsMS-DOS Prompt) and follow these steps:

C:
cd "Program Files"
cd Firefox
firefox --help > help.txt
type help.txt

The help options will appear in the newly created file help.txt. This advice goes for all options that provide command-line output, such as -version. You don't need to redirect anything on other platforms.

On Windows, you can use / (forward slash) or // (double forward slash) as the command-line switch prefix. On all platforms, Firefox-specific options can be preceded with - (minus) or -- (minus, minus). These two command lines are the same on Windows, but only the first one will work on Linux:

firefox -console --jsconsole http://www.example.com
firefox --console /jsconsole http://www.example.com

On Unix/Linux, some X11 options are supported. X11 X resources aren't supported, because the Unix/Linux port uses the Gtk configuration system. Table 1-4 describes the user-oriented options.

Table 1-4. User-oriented command-line options

Option

Windows?

Unix/Linux?

Macintosh?

Description

General options

-h, -help

Y

Y

Y

State command-line help and exit.

-v, -version

Y

Y

Y

State Firefox version and exit.

Browser options

URL

Y

Y

Y

Display a browser showing this URL.

-height X

Y

Y

Y

Specify window height in pixels.

-width X

Y

Y

Y

Specify window width in pixels.

-edit

N

N

N

Support for old Composer; does nothing by default.

-inspector

Y

Y

Y

Start the DOM Inspector window.

-jsconsole

Y

Y

Y

Start the JavaScript Console window.

-register

Y

Y

Y

Re-register the set of chrome packages.

-safe-mode

Y

Y

Y

Start without any extensions or plug-ins and stick to the default theme. Use as a last resort.

-install-global-extension "{UUID}"

Y

Y

Y

Move the extension with registration number UUID from the profile area to the install area.

-install-global-theme "{UUID}"

Y

Y

Y

Move the theme with registration number UUID from the profile area to the install area.

-list global-items

Y

Y

Y

List extensions and themes added to the install area.

-lock-item "{UUID}"

Y

Y

Y

Lock the extension or theme with this UUID so that the user can't delete it via the user interface.

-unlock-item "{UUID}"

Y

Y

Y

Unlock the extension or theme with this UUID so that the user can delete it via the user interface.

Mozilla options

-chrome D

Y

Y

Y

Start up a plain, chromeless window and display the document at URL D.

-installer

Y

Y

Y

Migrate data from other browsers on startup.

-P Foo

Y

Y

Y

Start up with profile Foo, or with the Profile manager if that profile doesn't exist.

-SelectProfile

Y

Y

Y

Start up with the profile selection dialog box.

-CreateProfile "prof dir"

Y

Y

Y

Auto-create a profile named prof in directory dir and make it the current profile. dir defaults to "."

-ProfileWizard

Y

Y

Y

Start up with the Profile Wizard and step the user through profile creation.

-ProfileManager

Y

Y

Y

Start up with the Profile Manager. On Mac OS X, Option-double-click Firefox.

-UILocale L

Y

Y

Y

Start with language locale L string labels for XUL content (toolbars and menus)

-contentLocale C

Y

Y

Y

Start with content locale C string labels for displayed pages' content.

Windows options

-kill

Y

N

N

Stop any running Firefox instance.

-console

Y

N

N

Tie any stdout and stderr output to a simple text window and display that as well.

Unix/Linux/X11/Gtk options

--g-fatal-warnings

N

Y

N

All warnings kill Firefox.

--display=X

N

Y

N

Choose the X11 display X.

--sync

N

Y

N

Synchronize all X11 calls.

--no-xshm

N

Y

N

Don't use X shared memory extension.

--install

N

Y

N

Give Firefox a private Gtk colormap.


Windows are opened in the order they appear on the command line.


1.12.1. See Also

For the more detailed programmatic command-line options, search for the DumpHelp() function at http://lxr.mozilla.org. For Unix/Linux specifically, consider also this URL: http://www.mozilla.org/unix/remote.html.

    Team LiB
    Previous Section Next Section