You can get the current bookmark directory e.g. via the onBookmark callback:
ui <- function(request) {
fluidPage(
textInput("txt", "Enter text"),
checkboxInput("caps", "Capitalize"),
verbatimTextOutput("out"),
bookmarkButton(),
p(),
textOutput("currentbookmarkDir")
)
}
server <- function(input, output, session) {
output$out <- renderText({
if (input$caps)
toupper(input$txt)
else
input$txt
})
bookmarkDir <- reactiveVal()
onBookmark(function(state){
bookmarkDir(state$dir)
})
output$currentbookmarkDir <- renderText(bookmarkDir())
}
shinyApp(ui, server, enableBookmarking = "server")
For further information please see:
https://shiny.rstudio.com/articles/advanced-bookmarking.html