Rev 46532 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File src/library/utils/man/browseURL.Rd% Part of the R package, http://www.R-project.org% Copyright 1995-2008 R Core Development Team% Distributed under GPL 2 or later\name{browseURL}\alias{browseURL}\title{Load URL into a WWW Browser}\description{Load a given URL into a WWW browser.}\usage{browseURL(url, browser = getOption("browser"), encodeIfNeeded = FALSE)}\arguments{\item{url}{a non-empty character string giving the URL to be loaded.}\item{browser}{a non-empty character string giving the name of theprogram to be used as hypertext browser. It should be in the PATH,or a full path specified. Alternatively, an \R function to becalled to invoke the browser.#ifdef windowsUnder Windows \code{NULL} is also allowed (and is the default), andimplies that the file association mechanism will be used.#endif}\item{encodeIfNeeded}{Should the URL be encoded by\code{\link{URLencode}} before passing to the browser? This is notneeded (and might be harmful) if the \code{browser} program/functionitself does encoding, and can be harmful for \code{file://} URLs on somesystems and for \code{http://} URLs passed to some CGI applications.Fortunately, most URLs do not need encoding.}}#ifdef unix\details{The default browser is set by option \code{"browser"}, in turn set bythe environment variable \env{R\_BROWSER} which is by default setin file \file{\var{\link[base:Rhome]{R\_HOME}}/etc/Renviron} to a choice made manually orautomatically when \R was configured. (See \code{\link{Startup}} forwhere to override that default value.)If \code{browser} supports remote control and \R knows how to performit, the URL is opened in any already running browser or a new one ifnecessary. This mechanism currently is available for browsers whichsupport the \code{"-remote openURL(...)"} interface (which includesOpera 5/6, Mozilla >= 0.9.5 and Mozilla Firefox),Galeon, KDE konqueror (via kfmclient) and the GNOME interface toMozilla. Netscape 7.0 and Opera 7 behave slightly differently,and you will needto open them first. Note that the type of browser is determined fromits name, so this mechanism will only be used if the browser isinstalled under its canonical name.Because \code{"-remote"} will use any browser displaying on the Xserver (whatever machine it is running on), the remote controlmechanism is only used if \code{DISPLAY} points to the local host.This may not allow displaying more than one URL at a time from aremote host.It is the caller's responsibility to encode \code{url} if necessary(see \code{\link{URLencode}}). This can be tricky for file URLs,where the format accepted can depend on the browser and OS.#ifdef windowsSome browsers have required \code{:} be replaced by \code{|} in filepaths: others do not accept that. All seem to accept \code{\\} as apath separator even though the RFC1738 standard requires \code{/}.#endif}#endif#ifdef windows\examples{\dontrun{browseURL("http://www.r-project.org")browseURL("file://d:/R/R-2.5.1/doc/html/index.html",browser="C:/Program Files/Mozilla Firefox/firefox.exe")}}#endif#ifdef unix\examples{\dontrun{## for KDE users who want to open files in a new taboption(browser="kfmclient newTab")browseURL("http://www.r-project.org")}}#endif\keyword{file}