Use getOption("viewer") to view HTML output if it is available as per RStudio. Fallback to browseURL if not available.

view_or_browse(url)

Arguments

url

character(1L) a location containing a file to display

Value

the return vaue of getOption("viewer") if it is a function, or of browseURL if the viewer is not available