R: Load URL into an HTML Browser

browseURL {utils} | R Documentation

## Load URL into an HTML Browser

### Description

Load a given URL into an HTML browser.

### Usage

    browseURL(url, browser = getOption("browser"),
              encodeIfNeeded = FALSE)

### Arguments

`url` | a non-empty character string giving the URL to be loaded. Some platforms also accept file paths.
`browser` | a non-empty character string giving the name of the program to be used as the HTML browser. It should be in the PATH, or a full path specified. Alternatively, an R function to be called to invoke the browser. Under Windows `NULL` is also allowed (and is the default), and implies that the file association mechanism will be used.
`encodeIfNeeded` | Should the URL be encoded by `URLencode` before passing to the browser? This is not needed (and might be harmful) if the `browser` program/function itself does encoding, and can be harmful for file:// URLs on some systems and for http:// URLs passed to some CGI applications. Fortunately, most URLs do not need encoding.

### Details

The default browser is set by option `"browser"`, in turn set by the environment variable R_BROWSER if that is set, otherwise to `NULL`. To suppress showing URLs altogether, use the value `"false"`.

Some browsers have required `:` be replaced by `|` in file paths: others do not accept that. All seem to accept `\` as a path separator even though the RFC1738 standard requires `/`.

To suppress showing URLs altogether, set `browser = "false"`.

### URL schemes

Which URL schemes are accepted is platform-specific: expect http://, https:// and ftp:// to work, but mailto: may or may not (and if it does may not use the user's preferred email client).

For the file:// scheme the format accepted (if any) can depend on both browser and OS.

### Examples

    ## Not run: browseURL("https://www.r-project.org")
    browseURL("file://d:/R/R-2.5.1/doc/html/index.html",
              browser = "C:/Program Files/Mozilla Firefox/firefox.exe")

    ## End(Not run)

[Package utils version 3.5.1 Index]