Hello,
I wanted to answer this topic "Shiny: Javascript enabled?". As it is closed since long I'm opening a new one (it seems very little posts get answers here :/).
TomasL asks if there is a quick way to check if javascript is enabled in a browser when accessing a shiny web app.
nteetor answers he is fairly certain most, if not all, shiny applications will not work if JavaScript is disabled in the browser.
This cannot be, as shinyapps.io offers the possibility to give a custom URL to your app.
When doing so, you can access your app through 2 different URL (note that original one is secure (443) when custom one is not (80)...).
If you use the custom URL, you will reach a webpage where the original app myaccount.shinyapps.io.myapp is embedded inside an iframe, which means JAVASCRIPT WILL BE DISABLED BY DEFAULT. Thus, all the JavaScript code you had in your app will be useless. That's why we really need a way :
1 - either to check if JavaScript is enabled in the current session
2 - or to check which URL people are visiting our app from (or if current protocol is secure (443) or not (80)).
I couldn't find a way to achieve this, any suggestion is welcomed
I ran some tests to display session$clientData in both URL, but it always shows the original URL informations, not the custom one, as it is executed server side (what we need is checking JavaScript / session information from the client side).
Basic reproducible example (you should be able to implement a custom URL in shinyapps.io to reproduce it though) :
library(shiny)
ui <- fluidPage(verbatimTextOutput("test"))
server <- function(input, output, session) {
output$test <- renderPrint ({
reactiveValuesToList(session$clientData)
})
}
shinyApp(ui = ui, server = server)