Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My favicon will not display on a browser tab for my app when using open source shiny server

I have been trying to find a way to associate a .ico with a shortcut to a shiny app hosted on an open source shiny server. Ultimately I would like the .ico to appear as the graphic for the shortcut to my app. And, I would like this icon to appear/be available for users when they create a shortcut to the app. (sounds simple enough but has proven to be a pretty difficult task). After a bunch of dead ends, I thought I would just work on getting the icon to display on the tab in the browser, and be available when someone favorites it.

I have found the following: Favicon in Shiny, https://groups.google.com/forum/#!topic/shiny-discuss/nU0AP8k0fvU, but the procedures don't seem to work with shiny server.

I can get the favicon to display on my local machine by saving it in the www folder of the app, but when I run the app from Rstudio server or from the shiny server via a link/shortcut, the .ico will not appear.

I found a related discussion where it was determined this was not possible https://github.com/rstudio/shinydashboard/issues/102

However...I still think it is because I was browsing the shiny gallery and noticed apps in the gallery display with a shiny icon in the browser tab. The only icon I can get to appear using shiny server is the empty document icon. Also, when I run my app with Rstudio server, the Rstudio R icon displays in the browser tab of the app, so its fishy.

Can anyone give some insight as to what is going on, and how I can get a nifty custom graphic for my shiny app?

like image 409
roberty boberty Avatar asked Mar 15 '19 16:03

roberty boberty


Video Answer


1 Answers

Try adding inside your dashboardBody function or in the UI function you are using:

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

If you have a .PNG file or both, you can use:

tags$head(
  tags$link(rel = "shortcut icon", href = "favicon.ico"),
  tags$link(rel = "apple-touch-icon", sizes = "180x180", href = "favicon.ico"),
  tags$link(rel = "icon", type = "image/png", sizes = "32x32", href = "/favicon-32x32.png"),
  tags$link(rel = "icon", type = "image/png", sizes = "16x16", href = "/favicon-16x16.png")
)
like image 121
Geovany Avatar answered Sep 25 '22 16:09

Geovany