Check if javaScript is enabled in Shiny

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 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 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 :slight_smile:
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 to reproduce it though) :

ui <- fluidPage(verbatimTextOutput("test"))
server <- function(input, output, session) {
output$test <- renderPrint ({
shinyApp(ui = ui, server = server)

Sorry I'm a new user here and Posit Community doesn't allow me to put links in my posts...

I'm confused. as far as I know shiny is implemented via javascript and an R to javascript interface, therefore the idea of shiny without javascript doesnt make sense to me ? I would think if javascript is disallowed you wont be able to run shiny at all, and if you can run shiny at all, javascript is being utilised. Sorry if this is not helpful or if misunderstood something; perhaps you can clarify ?

Shiny is disallowed on the client side when you call your app through custom URL (because original URL is called inside an iframe and this is seen as a security issue).
But yes, Shiny needs JavaScript to be executed on the SERVER side...
My problem is I have no way in my code to check if JavaScript is enabled on the client side because :
• if I check with an R-coded if statement, code will be executed on the server side and will always return TRUE (JavaScript is always enabled on the server side : as you said, Shiny needs it to work) ;
• if I check with a JavaScript-coded if statement, code will never be executed if JavaScript is disabled on the client side and it won't return anything, not even FALSE.
I hope it is more understandable now, thanks anyway for your help.