I try to display an existing HTML file as content in my R Shiny Dashboard App - similar as in this question. My HTML file also contains links to other local HTML files I would like to be able to click and follow as well.
I setup the minimal example as below. If I click the link in main.html, I want target.html to be displayed. Currently, when I click the link in main.html, I get a Not Found error.
Any help is highly appreciated.
Thanks, Jonathan
main.html
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><title>Head</title></head>
<body><a href="target.html">target</a></body>
</html>
target.html
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><title>Head</title></head>
<body><a href="main.html">back to main</a></body>
</html>
ui.R
library(shinydashboard)
dashboardPage(
dashboardHeader(title = "HTML Main"),
dashboardSidebar(
sidebarMenu(
menuItem("Main", tabName = "main")
)
),
dashboardBody(
tabItems(
tabItem(tabName = "main",
fluidRow(box(width=NULL, htmlOutput("html_main")))
)
)
)
)
server.R
library(shiny)
shinyServer(function(input, output) {
getPageMain<-function() {
return(includeHTML("C:/sub_link/main.html"))
}
output$html_main<-renderUI({getPageMain()})
})