defaultbrowser Command
Purpose
Starts the default web browser and optionally loads a specified URL.
Syntax
defaultbrowser [URL [new-window, new-tab]]
Description
The defaultbrowser command runs the browser launch command that is specified in the DEFAULT_BROWSER environment variable.
If a URL is given as an argument, it loads that URL into the browser. For it to work properly, the browser command must accept a URL as an argument.
The optional new-window and new-tab arguments can be used if the browser that is being started is the Mozilla web browser.
Both arguments must always be specified with a URL. This URL is then opened in a new browser window or a new tab. If the browser is not the Mozilla web browser, these two arguments are ignored.
The main purpose of the defaultbrowser command is to have applications use this command when they open a browser to display HTML documents or web-based applications.
This way, a system administrator must change only the DEFAULT_BROWSER environment variable when a new browser is installed and all applications automatically begin to use the new browser.
The DEFAULT_BROWSER environment variable must be set to the command that starts the required browser.
Include any arguments that must be included after the command to start a specific URL address.
For example, if the command to start a browser
and open a specific URL is wonderbrowser -r URL
,
then the DEFAULT_BROWSER environment variable is set to equal wonderbrowser
-r
.
If the DEFAULT_BROWSER environment variable is not defined, then the defaultbrowser command runs the Mozilla web browser if it is installed.
Examples
- To start the designated default browser and have it open to its
default home page, enter the following command:
defaultbrowser
- To start the designated default browser and have it open to the
URL
http://machine/path/file.html
, enter the following command:defaultbrowser http://machine/path/file.html
- To start the designated default browser and have it open the URL
http://machine/path/file.html
where if the default browser is Netscape, then the page is displayed in a window that is calledwebpage
, enter the following command:defaultbrowser http://machine/path/file.html webpage
- To start the designated default browser and have it open the URL
http://machine/path/file.html
in a new browser window if the browser is the Mozilla web browser, enter the following command:defaultbrowser http://machine/path/file.html new-window
- To start the designated default browser and have it open the URL
http://machine/path/file.html
in a new browser tab if the browser is the Mozilla web browser, enter the following command:defaultbrowser http://machine/path/file.html new-tab
Files
Item | Description |
---|---|
/usr/bin/defaultbrowser | The defaultbrowser command |