Search code examples
shinyfavicon

favicon not displaying in Shiny


I'd like to add a favicon to my shinymobile app and I can't figure out what I'm doing incorrect. The favicon works when i run the app locally however when i save to shinyapps.io. The code below shows my shiny app as well as the code for my manifest.json file. I have all of my images and favicon.io image saved in the www folder.

enter image description here

shiny app

library(shiny)
library(shinyMobile)

ui <- f7Page(manifest = "manifest.json",
             favicon = "favicon.ico",
             icon = '128x128.png')
server <- function(input, output){}

shinyApp(ui = ui, server = server)

manifest.json

{
  "name": "My App",
  "short_name": "My App",
  "description": "My App",
  "lang": "en-US",
  "start_url": "https://7bdev.shinyapps.io/test_shiny/",
  "display": "standalone",
  "icons": [
    {
      "src": "icons/128x128.png",
      "sizes": "128x128",
      "type": "image/png"
    },
    {
      "src": "icons/144x144.png",
      "sizes": "144x144",
      "type": "image/png"
    },
    {
      "src": "icons/152x152.png",
      "sizes": "152x152",
      "type": "image/png"
    },
    {
      "src": "icons/192x192.png",
      "sizes": "192x192",
      "type": "image/png"
    },
    {
      "src": "icons/256x256.png",
      "sizes": "256x256",
      "type": "image/png"
    },
    {
      "src": "icons/512x512.png",
      "sizes": "512x512",
      "type": "image/png"
    }
  ]
}

Solution

  • Im not familiar with the shinyMobile package, but you can simply add it to the head

    tags$head(tags$link(rel="shortcut icon", href="favicon.ico"))