get_all_info: Get all information about user's browser

View source: R/get_info.R

get_all_infoR Documentation

Get all information about user's browser

Description

Get a list with all the information detected about the user's browser.

The list 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_all_info()

Value

List with all information detected about the user's browser: device, browser, os, dimensions, user_agent

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.

Mobile vs desktop vs tablet

{shinybrowser} attempts to detect whether a device is "mobile" or "desktop". The distinction between mobile and desktop is not always clear, so if what you actually care about is the size of the device, it might be better to use get_width().

Tablets return ambiguous results; some tablets self-report as mobile devices while others as desktop.

Width and height

The width and height of the browser window are only reported once, when the detect() function is initially called. If the user resizes the browser window, the new dimensions are not reported until the page is refreshed.

See Also

detect(), get_browser(), get_browser_version(), get_os(), get_os_version(), get_device(), get_width(), get_height(), get_user_agent(), SUPPORTED_BROWSERS, SUPPORTED_DEVICES, SUPPORTED_OPERATING_SYSTEMS

Examples

if (interactive()) {
  library(shiny)

  ui <- fluidPage(
    shinybrowser::detect(),
    "Your browser information:",
    verbatimTextOutput("browser_info")
  )
  server <- function(input, output, session) {
    output$browser_info <- renderPrint({
      shinybrowser::get_all_info()
    })
  }
  shinyApp(ui, server)
}

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