[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 2

defaultbrowser Command

Purpose

Launches the default web browser and optionally loads a specified URL.

Syntax

defaultbrowser [ URL [Netscapewindowname]]

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 this to work properly, the browser command must accept a URL as an argument.

Netscapewindowname is an optional argument that can be used if the browser that is being launched is a Netscape browser. A URL must always be specified with a window name. That URL will then be opened into the named Netscape browser window. If a Netscape window with the specified name is already open, the URL will be opened into that window. If the window is not already open, a new Netscape browser window with the specified name will be opened. If the browser is not a Netscape browser, the Netscape window name argument will be ignored.

The main purpose of the defaultbrowser command is to have applications use this command when they need to open a browser to display HTML documents or web-based applications. This way, a system administrator only needs to change the DEFAULT_BROWSER environment variable when a new browser is installed and all applications will automatically begin using the new browser.

The DEFAULT_BROWSER environment variable should be set to the command that would launch the desired browser. Include any arguments that must be included after the command to launch a specific URL address. For example, if the command to launch a browser and open a specific URL is wonderbrowser -r URL, then the DEFAULT_BROWSER environment variable would be set to equal wonderbrowser -r.

If the DEFAULT_BROWSER environment variable is not defined, then the defaultbrowser command runs Netscape if it is installed.

If specified, URL indicates the page for the browser to load on startup. If a Netscapewindowname is also specified, and the browser is Netscape, Netscape opens a window of that name, or if a window of that name is already open, it will load the specified URL in that window. Window name cannot be used unless a URL is also specified. If a window name is specified and the browser is not Netscape, then the window name is ignored.

Examples

  1. To launch the designated default browser and have it open to it's default home page, enter:

    defaultbrowser
  2. To launch the designated default browser and have it open to the URL http://machine/path/file.html, enter:

    defaultbrowser http://machine/path/file.html
  3. To launch 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 called webpage, enter:

    defaultbrowser http://machine/path/file.html webpage

Files

/usr/bin/defaultbrowser The defaultbrowser command

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]