简体   繁体   English

如何在 Shiny UI 中动态显示本地 html 文件?

[英]How can I display a local html file in Shiny UI dynamically?

An example.html gets created in a local directory by another script.另一个脚本在本地目录中创建了一个 example.html。 Until then, Shiny UI should show an empty screen, and when the example.html gets generated, it should be reflected in Shiny UI.在那之前,Shiny UI 应该显示一个空屏幕,当 example.html 生成时,它应该反映在 Shiny UI 中。

The example.html is loaded into the Shiny UI, but it is not getting reflected. example.html 已加载到 Shiny UI 中,但未得到反映。

This is the code I've tried, at least for displaying the file这是我试过的代码,至少用于显示文件

Code:代码:

ui = shinyUI(fluidPage(titlePanel("Generated Report"),
                       mainPanel(htmlOutput("showfile"))
                       )
             )

server = function(input, output, session){
  output$showfile <- renderUI({
    includeHTML("C://Users//DELL//Desktop//abc_files//www//report.html")
    # HTML(readLines(file_to_show))
  })

}

shinyApp(ui, server)

If you want to display the ...report.html file in your shiny app, the // in your path-to-file are not correct.如果您想在闪亮的应用程序中显示 ...report.html 文件,则文件路径中的//不正确。

This script (with a single / ) will display the HTML file.此脚本(带有单个/ )将显示 HTML 文件。

ui = shinyUI(fluidPage(titlePanel("Generated Report"),
                   mainPanel(htmlOutput("showfile"))
                   )
         )

server = function(input, output, session){
  output$showfile <- renderUI({
    includeHTML("C:/Users/DELL/Desktop/abc_files/www/report.html")
    # HTML(readLines(file_to_show))
  })

}

shinyApp(ui, server)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我可以动态设置html类吗? 还是Shiny如何设置&#39;html&#39;.hasClass(&#39;Shiny-busy&#39;)? - Can I set html class dynamically? Or how does Shiny set 'html'.hasClass('Shiny-busy')? 如何将rcharts(nplot)嵌入到html文件中? - how can i embed rcharts(nplot) into shiny with html file? 动态加载时,如何从 a.txt 文件中获取动态内容以显示在多个 html 页面中 - How can I get dynamic content from a .txt file to display in multiple html pages when they are loaded dynamically 如何将laravel中本地public/uploads文件夹中的pdf文件显示为html<iframe> - How can I display pdf file from local public/uploads folder in laravel into html <iframe> 如何在UIWebView中显示本地html文件? - How do I display a local html file in a UIWebView? 如何将文件上传并显示到 html - How can I upload and display file to html 如何在HTML文件上显示工具提示? - How can I display a tooltip on an HTML file? 如何在Windows Phone Web浏览器中显示本地HTML? - How can I display local HTML in the windows phone web browser? 如何在Shiny的服务器功能中包含HTML下载链接到本地​​文件? - How to include an HTML download link to a local file in the server function in Shiny? 如何在Android中显示本地html文件? - How to display a local html file in Android?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM