How can I include a remote JS file in my app using shinydashboard? I know there is the includeScript
function. I tried
...
# using shiny dashbo
You can include remote JS files using the src
argument of a script
tag
library(shiny)
jsfile <- "https://gist.githack.com/daattali/7519b627cb9a3c5cebcb/raw/91e8c041d8fe4010c01fe974c6a35d6dd465f92f/jstest.js"
runApp(shinyApp(
ui = fluidPage(
tags$head(tags$script(src = jsfile))
),
server = function(input, output) {
}
))
EDIT: Ok, so you want this to work with a shinydashboard. It makes sense why your way doesn't work. Look at the documentation for dashboardPage
. The first argument is header
. You can't just start providing tags/UI elements you want to include. The includescript or any other such elements should go inside the dashboardBody. For example
library(shiny)
library(shinydashboard)
jsfile <- "https://gist.githack.com/daattali/7519b627cb9a3c5cebcb/raw/91e8c041d8fe4010c01fe974c6a35d6dd465f92f/jstest.js"
runApp(shinyApp(
ui = dashboardPage(
header = dashboardHeader(),
sidebar = dashboardSidebar(),
body = dashboardBody(
tags$head(tags$script(src = jsfile))
)
),
server = function(input, output) {
}
))