Get directory of shiny bookmark


Is there a function that returns the directory for the bookmarks that shiny is using?
That is probably a simple question but I could not find an answer for this.


You can get the current bookmark directory e.g. via the onBookmark callback:

ui <- function(request) {
    textInput("txt", "Enter text"),
    checkboxInput("caps", "Capitalize"),
server <- function(input, output, session) {
  output$out <- renderText({
    if (input$caps)
  bookmarkDir <- reactiveVal()
  output$currentbookmarkDir <- renderText(bookmarkDir())

shinyApp(ui, server, enableBookmarking = "server")

For further information please see:

I was hoping for a function that could return the bookmark directory before any bookmark is created. How is shiny-server choosing a directory? In runApp() it seems to create shiny-bookmarks directory. But in shiny-server the name seems to be the app name together with a random hash.

I should clarify the question. I have the following shiny config and would like to know the bookmark directory for the apps running on that server before a bookmark was created. I would like to copy bookmarks from someone else and put them into that directory.

run_as shiny;

server {

  listen 6860;

  location / {

    # This is that makes the /apps URL component work
    # site_dir /srv/shiny-server;
		site_dir /datashare/apps;

    # The Shiny Server logs will go to a place on your host vs in the VM
    log_dir /var/log/shiny-server;

		# bookmarks
		bookmark_state_dir /datashare/shiny_bookmarks;

		# timeouts
		app_idle_timeout 0;

    directory_index on;



Using shiny-server the directory can be configured:

Also see this related thread.

But the apps on the server will create separate directories inside that state directory.

You could use session$doBookmark() to once force the creation of the bookmark directory and read it back in using the onBookmark callback. After this delete the dummy bookmark.

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.