New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should add current URL hash to clientData #1418
Comments
I'm used to the assumption that |
|
@wch this is about to be merged in the pseudo-nav PR (#1447). Here's the sample app (using the ## Printing the value of the URL hash
## (Use the back and forward buttons to see how the browser
## keeps a record of each state)
shinyApp(
ui = fluidPage(
textInput("txt", "Enter new hash"),
helpText("Format: #hash"),
actionButton("go", "Update"),
hr(),
verbatimTextOutput("hash")
),
server = function(input, output, session) {
observeEvent(input$go, {
updateQueryString(input$txt, mode = "push")
})
output$hash <- renderText({
hash <- getUrlHash()
paste("Your hash is:\n", hash)
})
}
) What do you think? |
Currently,
clientData
only contains the initial URL hash, but it doesn't have the current URL hash. This is because not all browsers at the time supported theonhashchange
event. See the comment here:https://github.com/rstudio/shiny/blob/9613c58/srcjs/init_shiny.js#L412-L416
Pretty much all browsers these days support it, even IE8. See:
http://caniuse.com/#search=onhashchange
http://benalman.com/projects/jquery-hashchange-plugin/
The text was updated successfully, but these errors were encountered: