get_browser: Get user's browser

View source: R/get_info.R

get_browserR Documentation

Get user's browser

Description

Get the user's browser name (such as "Chrome" or "Firefox") and version.

The value is reactive, therefore it must be accessed inside a reactive context (such as an observe or reactive).

{shinybrowser} must be initialized with a call to detect() in the app's ui.

Usage

get_browser()

get_browser_version()

Value

User's detected browser type

User's detected browser version

Accuracy

It's important to understand there is no reliable way to detect the information in {shinybrowser} with 100% accuracy.

{shinybrowser} makes a best effort at identifying the most accurate information, but some browser/operating system combinations may be difficult to identify. Users can also use a variety of tools to deliberately spoof this information.

With that in mind, {shinybrowser} should detect the correct information in most cases.

Supported values

Only major browsers and operating systems are supported, which means that the RStudio Viewer may result in an "UNKNOWN" browser, and unpopular operating systems may also result in "UNKNOWN".

For a list of values that can be detected, see SUPPORTED_BROWSERS, SUPPORTED_DEVICES, and SUPPORTED_OPERATING_SYSTEMS.

See Also

detect(), get_all_info(), is_browser_ie(), is_browser_chrome(), is_browser_firefox(), SUPPORTED_BROWSERS

Examples

if (interactive()) {
  library(shiny)

  ui <- fluidPage(
    shinybrowser::detect(),
    "Your browser:",
    textOutput("browser_info")
  )
  server <- function(input, output, session) {
    output$browser_info <- renderText({
      paste(shinybrowser::get_browser(), "version", shinybrowser::get_browser_version())
    })
  }
  shinyApp(ui, server)
}

daattali/shinybrowser documentation built on Aug. 21, 2024, 6:12 a.m.