bookmarking multiple reactive tabs not working in shiny

Hi all,

Really appreciate if anyone can help me here since I am stuck after researching on this everywhere.

The below application is updating the url based on row selected in the DT table and the selected tab. But what happens is, when the user copy paste the url in another tab, it is not opening the specific tab, instead it is opening the default page (url :

I mean reactive tabs are not working.

Please follow these steps for the reference

  1. Click on any row(say 3) on DT table(Summary tab)
  2. An new tab3 opens (that is fine) which prints 3
  3. Copy the url now (tab3 url)
  4. Paste this url to another tab (Now it returns to Summary tab only and not tab3).

Am I doing something wrong here?


ui <- function(request) {
    "Title", id = "inTabset", selected = "Summary",
    tabsetPanel(id = "tabs",
                # tabPanel(
                #   "Readme",tags$head(tags$link(rel = "stylesheet", type="text/css", href="style.css"))
                # ),

server <- function(input, output, session) {
  # Make sure you only bookmark the tabsetPanel
  setBookmarkExclude(isolate(names(input)[names(input) != "tabs"]))
  # Every time the tab changes, store the app state as URL bookmark
  observeEvent(input$tabs, {
  # Set callback that stores the app state in the URL
  onBookmarked(function(url) {
    updateQueryString(paste0("?tabs=", input$tabs), mode = "replace")
  # Set callback to restore the app state from the URL
  onRestore(function(state) {
    updateTabsetPanel(inputId = "tabs", selected = getQueryString()[["tabs"]])
  output$tab <- renderDataTable({
    datatable(iris,selection = 'single')
  observeEvent(input$tab_rows_selected, {
    insertTab(inputId = "tabs",
              tabPanel(paste0("tabs",input$tab_rows_selected), "This a dynamically-added tab",htmlOutput("sd")),
              target = "Summary",select = TRUE
  output$sd <- renderUI({

shinyApp(ui, server)

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.