get_device | R Documentation |
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.
get_device()
User's detected decive type ("Mobile" or "Desktop")
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.
{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.
detect()
, get_all_info()
, is_device_mobile()
, is_device_desktop()
,
get_width()
, get_height()
if (interactive()) {
library(shiny)
ui <- fluidPage(
shinybrowser::detect(),
"Your device:",
textOutput("device_info")
)
server <- function(input, output, session) {
output$device_info <- renderText({
shinybrowser::get_device()
})
}
shinyApp(ui, server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.