Here's a small example using the JS function from this answer. From the comments, it sounds like the solution isn't perfect, but is a good starting point.
library(shiny)
js <- "
// execute the code after the shiny session has started
$(document).on('shiny:sessioninitialized', function(event) {
// browser detection from https://stackoverflow.com/a/5918791/8099834
navigator.sayswho= (function(){
var ua= navigator.userAgent, tem,
M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\\/))\\/?\\s*(\\d+)/i) || [];
if(/trident/i.test(M[1])){
tem= /\\brv[ :]+(\\d+)/g.exec(ua) || [];
return 'IE '+(tem[1] || '');
}
if(M[1]=== 'Chrome'){
tem= ua.match(/\\b(OPR|Edge)\\/(\\d+)/);
if(tem!= null) return tem.slice(1).join(' ').replace('OPR', 'Opera');
}
M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
if((tem= ua.match(/version\\/(\\d+)/i))!= null) M.splice(1, 1, tem[1]);
return M.join(' ');
})();
// pass browser info from JS to R
Shiny.onInputChange('myBrowser', navigator.sayswho);
});
"
ui <- fluidPage(
tags$head(
tags$script(HTML(js))
),
textOutput("myBrowserOutput")
)
server <- function(input, output, session) {
output$myBrowserOutput <- renderText({
input$myBrowser # contains the value returned by the JS function
})
}
shinyApp(ui, server)