我正在将 shiny 应用程序部署到 shinyapps.io。它旨在与桌面浏览器一起使用,但在移动设备上访问该应用程序时,它会更改为移动 View (这很酷但在这种情况下没有用)。
知道如何为 Shiny 的应用程序强制桌面 View 吗?
我试过这个答案:How to force desktop view on mobile devices - Bootstrap?但没有让它发挥作用。
(不幸的是没有 javascript 经验...)
最佳答案
这个问题有你需要的,包括 <meta>
在 HTML
中标记:
library(shiny)
# Define UI for application that draws a histogram
ui <- fluidPage(
HTML('<meta name="viewport" content="width=1024">'),
# Application title
titlePanel("Old Faithful Geyser Data"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot")
)
)
)
# Define server logic required to draw a histogram
server <- function(input, output) {
output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
}
# Run the application
shinyApp(ui = ui, server = server)
无标签:
标签后:
关于r - 强制 Shiny 的应用程序在移动设备上显示桌面 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49919317/