How can I include a remote JS file in my app using shinydashboard? I know there is the includeScript
function. I tried
...
# using shiny dashboard
ui <- dashboardPage(
includeScript("http://the.path.to/my/js-file.js")
dashboardHeader(
title = "My title",
titleWidth = 400
),
...
This results in the error:
Error in tagAssert(header, type = "header", class = "main-header") :
Expected tag to be of type header
I attempted to place the call in other places, combine it with tags$head
, store the JS file locally and load it with a local path reference, but to no avail.
So I am stuck at the following questions?
- Can I actually use
includeScript
with a path to a remote resource? - Where do I need to put which instruction to load the JS file (and where does the JS file need to reside)?
A solution has been proposed by @daattali for a purely Shiny based implementation (no shinydashboard) using tags$head
, but this does not appear to work with shinydashboard.