# install.packages("devtools") devtools::install_github("aoles/shinyURL")
Load the package in both server.R and ui.R.
In server.R, add inside the server function a call to
sessionis the argument passed to the server function.
Add the shinyURL widget to ui.R.
Restoring of tabset and navbar panels
To save and restore active tabs provide the
id argument to the functions
Disable encoding of certain inputs
You can suppress certain inputs from being encoded in the query URL by using IDs with a leading dot, e.g.
.inputName. These inputs won't be restored.
The state of a shiny app gets saved by encoding its input values into an URL. To keep the URL compact and to avoid problems caused by the URL length limit (around 2000 characters) there are some points to keep in mind when developing your app.
Avoid long names of inputs but rather use short IDs. For example, instead of
selectInput("firstDrug", "First drug", choices = drugs)
it's better to have
selectInput("d1", "First drug", choices = drugs)
Use named lists for the
checkboxGroupInput. Then only the names are displayed to the user allowing for shorter values of the control.
These points are especially relevant for apps with lots of controls.
Unfortunately, operations performed using action buttons cannot be reliably recorded and restored.