DT::renderDataTable not render using HTML UI - MIME type error

Hello,

using the DT::renderDataTable function is working ok using RStudio and ShinyApps.io, but when I change the UI tu use HTML is still working in RStudio but in ShinyApps.io I have an error in tje browser

"Refused to apply style from because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled"

This is the code

library(DT)
server <- function(input, output) {
output$mytable = DT::renderDataTable({
mtcars
})
}
shinyApp(ui = htmlTemplate("www/index.html"), server)

Regards,
Fran

you can see the error in https://cege.shinyapps.io/TestTabla/

Don't put your template in the www/ directory:

https://shiny.rstudio.com/articles/templates.html

To use an HTML template for the UI, first create an HTML file in your app directory, at the same level as the ui.R , server.R , or app.R files (not in a www/ subdirectory). Here’s an example template for a complete web page,

I can see in the console that the external JS and CSS files are not loaded. Did you include the headcontent() tag in your html file like below:

<!DOCTYPE html>
<html>
  <head>
    <script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script>
    {{ suppressDependencies("d3") }}
    {{ headContent() }}
  </head>
  ...
</html>

Hello,

thanks for your help, finally I use the addResourcePath() to upload all the necessary files and folders. Was useful the resourcePaths() with the working example to understand the folders necessary to add.

Regards,

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.