diff --git a/R/offline.R b/R/offline.R index 344f8c515c..75eeb3c37d 100644 --- a/R/offline.R +++ b/R/offline.R @@ -114,6 +114,6 @@ get_browser <- function() { # default web browser if (is.null(browseR) || !is.function(browseR) || inherits(try(browseR('http://www.rstudio.com'), silent = TRUE), 'try-error')) - browseR = getOption("browser") + browseR = browseURL browseR } diff --git a/R/print.R b/R/print.R index 097757662d..99d31b5152 100644 --- a/R/print.R +++ b/R/print.R @@ -41,7 +41,7 @@ knit_print.plotly <- function(x, options, ...) { #' @export print.offline <- function(x, ...) { off <- offline_bundle(jq = TRUE) - plotlyjs <- readChar(off, file.info(off)$size) + plotlyjs <- readChar(off, file.info(off)$size, useBytes=TRUE) html <- sprintf( '
@@ -62,7 +62,7 @@ print.offline <- function(x, ...) { } index <- file.path(d, "index.html") res <- writeLines(html, index) - if (!is.null(x$viewer)) x$viewer(index) + if (is.function(x$viewer)) x$viewer(index) } #' Embed a plotly iframe into an R markdown document via \code{knit_print} @@ -80,7 +80,7 @@ knit_print.offline <- function(x, options, ...) { # if this is the first plot, place bundle just before the plot if (length(knitr::knit_meta(class = "plotly", clean = FALSE)) == 0) { off <- offline_bundle(jq = TRUE) - b <- readChar(off, file.info(off)$size) + b <- readChar(off, file.info(off)$size, useBytes=TRUE) p <- paste0( sprintf('', b), p