# browseURL

0th

Percentile

##### Load URL into an HTML Browser

Load a given URL into an HTML browser.

Keywords
file
##### Usage
browseURL(url, browser = getOption("browser"),
encodeIfNeeded = FALSE)
##### Arguments
url
a non-empty character string giving the URL to be loaded.
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 Rfunction 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 which is by default set in file R_HOME/etc/Renviron to a choice made manually or automatically when Rwas configured. (See Startup for where to override that default value.) To suppress showing URLs altogether, use the value "false". On many platforms it is best to set option "browser" to a generic program/script and let that invoke the user's choice of browser. For example, on OS X use open and on many other Unix-alikes use xdg-open. If browser supports remote control and Rknows how to perform it, the URL is opened in any already-running browser or a new one if necessary. This mechanism currently is available for browsers which support the "-remote openURL(...)" interface (which includes Mozilla and Opera), Galeon, KDE konqueror (via kfmclient) and the GNOME interface to Mozilla. (Firefox has dropped support, but defaults to using an already-running browser.) Note that the type of browser is determined from its name, so this mechanism will only be used if the browser is installed under its canonical name.

Because "-remote" will use any browser displaying on the X server (whatever machine it is running on), the remote control mechanism is only used if DISPLAY points to the local host. This may not allow displaying more than one URL at a time from a remote host.

It is the caller's responsibility to encode url if necessary (see URLencode). This can be tricky for file URLs, where the format accepted can depend on both browser and OS.

To suppress showing URLs altogether, set browser = "false". The behaviour for arguments url which are not URLs is platform-dependent. Some platforms accept absolute file paths; fewer accept relative file paths.

• 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".

• browseURL
##### Examples
library(utils) 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")
Documentation reproduced from package utils, version 3.3, License: Part of R 3.3

### Community examples

Looks like there are no examples yet.