Closed zhengzheli closed 1 year ago
Correct, these functions are using browseURL
. The online help should indicate this:
open(): Open the item in your browser.
Can you give me more info on your use case? I'm very leery of dragging Shiny in as a dependency, or adding custom JS code.
Thanks for your response. I was originally using it to try and open a file on the document library of a SharePoint site. e.g.
documentLibrary <- sharepointSite$get_drive("Documents")
documentLibrary$open_item(sharepointFullPath)
That didn't seem to work, so I used shinyjs to run the following js:
js_code <- "
shinyjs.browseURL = function(url) {
window.open(url,'_blank');
}"
However, now I am not using the sharepoint document library but using a onedrive document library instead, which is working well.
documentLibrary <- user$get_drive()
documentLibrary$get_item(path)$open()
So currently don't need this issue to be fixed. Thanks.
That's very strange. Sharepoint and Business Onedrive use the same backend, so it should either work with both, or fail with both.
To clarify, are you running your R code on your own machine? Or in a remote session, eg in an Rstudio Cloud workspace?
On a remote session, a Shiny server. But testing on local machine. Actually I haven't tested it lately; it was a while ago, and quite possibly there was something wrong with my earlier test. Thanks for your response.
Basically if you're running your code on your local machine, then open()
will work. Otherwise, it won't, as base R doesn't know how to open a browser in that case.
They work fine locally. The situation seems to be similar to that reported here with browseURL. Are these functions using browseURL behind the scenes? In the logs of remote server I get a message similar to below:
As a workaround I was able to use shinyjs