Controlling a web browser from WAVE

On Unix and Unix-like platforms such as GNU/Linux, WAVE uses a web browser to display external data associated with link annotations, and to display the on-line version of this guide. A suitable web browser must be installed on the WAVE host in order for this to work. By default, WAVE uses Firefox (http://www.mozilla.org/firefox/); several other browsers, including Galeon, Konqueror, Mozilla, Netscape, and Opera, can also be controlled by WAVE . If you prefer to use one of these rather than Firefox, set the environment variable URLV to the name of your browser.

WAVE controls the web browser in the same way it controls other external programs: by running commands in the Analysis Commands window. WAVE 's interface to the web browser is defined by the line beginning with the <Open URL> tag in WAVE 's menu file. In the standard version of the menu file, this line reads:

  <Open URL>    url_view $URL
As this example illustrates, the menu variable $URL can be used to pass the selected URL from WAVE to your browser. (WAVE expands any incomplete URLs from annotation files as needed before evaluating $URL.)

The program url_view is a shell script (normally installed at the same time as WAVE , and in the same directory) that handles starting the browser if necessary and instructing it to display the specified URL. If URLV is not set, or if you have set it to firefox, url_view does so using the command:

 ( firefox -remote 'openURL($URL)' || firefox $URL ) &
In this case, WAVE (via url_view) first uses Firefox's -remote option to instruct an already-running copy of Firefox to open the desired URL. This is a very fast operation if Firefox is already running (since Firefox is already in RAM, it is not necessary to load another in order to run the firefox -remote ... process, and the remote process efficiently delivers its message and exits immediately). If Firefox was not running, the firefox -remote command fails, and (in this case only) url_view starts a new Firefox browser process.

The url_view script includes analogous commands for each of the other supported browsers. If url_view does not recognize the browser named by URLV, it simply runs:

 ( $URLV $URL ) &
but this is (in general) much slower, since launching a new instance of the browser for each URL will take much more time than reusing an already-open window, as for the supported browsers.

To configure WAVE to use a different web browser, edit the url_view script appropriately. (You may also do this by editing the action associated with <Open URL>, but it's better to modify url_view, since WAVE also uses url_view to display some of its on-line help. If you decide to modify the action in the WAVE menu file, be careful not to change the <Open URL> tag at the beginning of the line, since WAVE uses this tag to identify the browser interface command within the menu file.) Consult the documentation for your browser to see what commands will be needed. (The -remote option is used by Firefox, Mozilla, Netscape, and Opera; Galeon and Konqueror use variations on this approach, and other browsers will probably require different methods.) Browsers that do not support any means of remote control are best avoided (since the only way to use them is to start a new browser for each new URL, a very inefficient solution).

George B. Moody (george@mit.edu)
2019-03-08