browseFile: Browse a system file in the default browser

View source: R/utils.R

browseFileR Documentation

Browse a system file in the default browser

Description

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)


openvolley/ovideo documentation built on March 19, 2024, 9:52 p.m.