Skip to contents

RStudio overrides the default behaviour of browseURL on some platforms, meaning that local files are not opened as file:///... URLs but as http://localhost.... This can break some local HTML files that are expecting to be served as file:/// URLs.

Usage

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

Arguments

url

string: as for utils::browseURL()

browser

string: as for utils::browseURL()

encodeIfNeeded

logical: as for utils::browseURL()

Examples

myfile <- tempfile(fileext = ".html")
cat("<h1>Hello!</h1>", file = myfile)

## in RStudio on Linux, this will be opened as a http://localhost URL
if (interactive()) browseURL(myfile)

## but this shouldn't
browseFile(myfile)