get_os {shinybrowser} | R Documentation |
Get user's operating system
Description
Get the user's operating system (such as "Windows" or "Mac" or "Android") and version
(such as "10" for Windows or "OS X" for Mac).
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_os()
get_os_version()
Value
User's detected operating system
User's detected operating system 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_os_windows()
,
is_os_mac()
, SUPPORTED_OPERATING_SYSTEMS
Examples
if (interactive()) {
library(shiny)
ui <- fluidPage(
shinybrowser::detect(),
"Your operating system:",
textOutput("os_info")
)
server <- function(input, output, session) {
output$os_info <- renderText({
paste(shinybrowser::get_os(), "version", shinybrowser::get_os_version())
})
}
shinyApp(ui, server)
}