WEBROWSE 1 1.2.0

Table of contents


NAME

webrowse - browse the given input in a local web browser, with markup

SYNOPSIS

webrowse [ -N | -M ] [ -s | -m | -u ] [ -k minutes ] [ -p | -a ] [ -i id ] [ -wrnvo ] [ -h ] [ file ]

DESCRIPTION

Webrowse can be used for convenient file or URL loading remote control of Netscape or Mosaic browsers, for textual reference HTML markup, and, for example, for interfacing a browser to news and mail readers as a hypertextual external viewer for mail messages or news articles containing HTML or containing text with embedded URLs, mail addresses and other references. See the EXAMPLES section below.

Simply given a file argument, webrowse will direct a browser already running on the user's display to load the given file. With Netscape, the browser may be automatically deiconified and raised as well. The browser must be running on the same (network) filesystem. If the -m option is supplied, webrowse will interpret the file as text and create and load a temporary copy of the file containing HTML markup to hyperlink the URLs, FTP locations, mail addresses, header newsgroups, news article IDs, and filesystem pathnames in the text to their references. A temporary file is used to hold and load the standard input if no file argument is given. By default, the temporary files are deleted 10 minutes after they've been first loaded by the browser. This delay can be set or disabled with the -k option or WB_KEEP environment variable. If the -u option is supplied, webrowse will interpret the command line argument, or the standard input if there isn't one, as a URL to browse.


OPTIONS

-N
Use a Netscape browser. This is the default unless the WB_BROWSER environment variable is set to mosaic.
-M
Use a Mosaic browser. This is the default only if the WB_BROWSER environment variable is set to mosaic.
-s
Tag and treat the standard input as HTML instead of text.
-m
Markup and load a text copy of the input (whether a file or the standard input) with heuristically identified hyperlinks to Web, FTP, mail, news and file references.
-u
Take the command line argument, or the standard input if there isn't one, as a URL to browse, instead of as a file.
-k minutes
Keep (ie, don't delete) any temporary files for the given integer number of minutes. If the minutes is the string forever, then the temporary files aren't ever deleted by webrowse, under the assumption they will be cleaned up later by some other means. Once temporary files are deleted, the browser will not be able to reload or re-enter them. The default is the value of the WB_KEEP environment variable, or 10 minutes if it isn't set.
-p
Use a sleeping background shell process to delete any kept temporary files. This will fail to complete should the process be killed while sleeping, and is only recommended for short temporary file lifetimes. This method is the default unless the WB_SLEEP environment variable is set to at.
-a
Use an at(1) job to delete any kept temporary files. This method is the default only if the WB_SLEEP environment variable is set to at.
-i id
The window ID (with Netscape) or process ID (with Mosaic) of an existing browser to use for loading. The default is any value of the WB_ID environment variable (see for more details).
-w
Open a new browser window, off of an already running browser, for loading the input. By default, any running browser window may be used.
-r
Don't deiconify/raise the browser window. The default for Netscape is to raise the window, while Mosaic will never raise the window.
-n
Don't actually use the browser at all. This is useful if only what is printed is of interest.
-v
Prints the shell command to run for remote control of the browser. This works with Netscape only.
-o
Prints the input (whether a file or the standard input, or whether marked up or not), perhaps in addition to loading it into the browser. This can be used to capture the marked up version of the input for other uses.
-h
Prints a helpful usage message.

ENVIRONMENT VARIABLES

WB_BROWSER
The default browser to use, Netscape by default, unless set to mosaic. This may be overridden by the -N or -M options.

WB_NETSCAPE
The Netscape browser command name to use, netscape by default.

WB_TMP
The directory in which to create any temporary files for use with either browser. The default depends on the browser in use. This may be overridden by the WB_NSTMP or WB_MSTMP environment variables.

WB_NSTMP
The directory in which to create any temporary files for use with Netscape, $HOME/.netscape by default. This overrides WB_TMP.

WB_MSTMP
The directory in which to create any temporary files for use with Mosaic, /tmp by default. This overrides WB_TMP.

WB_UMASK
webrowse uses a umask of 077 when creating temporary files, unless overriden with this.

WB_KEEP
The number of minutes to wait before deleting any temporary files, or the string forever if they're not ever to be deleted. 10 minutes is the default. This may be overridden by the -k option.

WB_SLEEP
The default method to use to delete kept temporary files, sleep by default, unless set to at. This may be overridden by the -p or -a options.

WB_ID
With Netscape, this can be set to the window ID of an existing browser window to specify the use of that window for loading, instead of just the first one found on the display. For example, under X Windows, xwininfo(1) or xlswins(1) can identify window IDs. With Mosaic, this can be set to the process ID of a running browser to specify the use of that browser for loading, instead of the one associated with the process ID listed in the file $HOME/.mosaicpid. This may be overridden by the -i option.

WB_PWD
The command to run to determine the current working directory, instead of the configured default command (usually pwd(1)).

EXAMPLES

Besides its usage directly from the command line, webrowse can be useful as a tool within other scripts and, creatively, as an interface between a web browser and other applications. Most usages fall into two categories. One, based on webrowse -s, is useful for sending HTML that is found outside a web context into a browser so it may be viewed properly. The other, based on webrowse -m, is useful for sending text that contains URLs, mail addresses, filesystem pathnames, etc into a browser with these items conveniently hyperlinked.

The following vi(1) macros, for your .exrc file, may be used to view the currently editted text in a browser with markup (and perhaps in a new window), or to (re)load the currently editted file into a browser from vi. The latter can facilitate HTML development with vi using a browser for WYSIWYG-like viewing of the developing HTML source. (Control characters are shown in carat-notation. Type, for example, <TAB>wb to invoke the first macro.)

     map ^V^Iwb :w !webrowse -m 
     map ^V^Iwn :w !webrowse -mw^M
     map ^V^Iww :!webrowse %^M

If you receive a mail message in HTML with mailx(1), the following configuration in your .mailrc file will allow you to view the message in your browser via mailx's pipe command.

     set cmd='webrowse -s'

If you receive a news article containing URLs with nn(1), the following configuration in your .nn/init file will allow you to view the article with markup in your browser via nn's I command.

     map both I (
             save-full "|webrowse -mw"
     )

FILES

$HOME/.netscape/webrowse*
Temporary files for markup and loading. The default with Netscape unless the directory is changed via WB_NSTMP or WB_TMP.

/tmp/webrowse*
Temporary files for markup and loading. The default with Mosaic unless the directory is changed via WB_MSTMP or WB_TMP.

$HOME/.mosaicpid
Used to determine the process ID of a Mosaic browser. Created by Mosaic.

/tmp/Mosaic.*
Created, used and kept to communicate loading information to Mosaic.

CAVEATS

The textual pattern matching used to identify URLs, FTP locations, mail addresses, header newsgroups, news article IDs, and filesystem pathnames is completely heuristic and can easily misidentify items. In practice, it's quite accurate, but occasionally text is identified as an FTP location (eg, hostname:path) or a filesystem pathname when it really isn't. Webrowse is designed to err on the side of overidentifying such references, to make it most useful when browsing temporary markup. Also, if the input text is exceptionally large, the pattern matching can become prohibitively expensive to compute. In such cases as these, a different program may be used to perform the markup, with its output piped into webrowse.

AUTHOR

Steve Kinzler, kinzler@cs.indiana.edu, May 96/Jan 98

URL

http://www.cs.indiana.edu/hyplan/kinzler/home.html#unix

SEE ALSO

netscape(1), Mosaic(1), umask(1), sleep(1), at(1), xwininfo(1), xlswins(1), pwd(1), kill(1), vi(1), mailx(1), nn(1)