1

I'm trying to add a favicon to my R Shiny app and I want to use a local image file so it can run without Internet connectivity. Using the example Emms gave here I've got a program that will display the favicon when it's using the NOAA logo's url. However, when I saved that exact image to my computer, I've not been able to get it to display. I've tried:

  1. feeding the href parameter a complete file path "C:/Users/...favicon.ico"
  2. feeding the href parameter only a file path that begins where the current working directory (viewed with getwd()) leaves off
  3. putting the downloaded NOAA logo .ico into a folder called "www" and placing it with my project/where my current directory is viewing (I don't know if guidance on folders named 'www' applied to local readings, but I figured I'd try it anyway)
  4. According to Giancarlo Tamburello's answer on the same page, I tried using this site to encode that same NOAA logo as a Base 64 character string--this required changing the whole function a bit, so that I assigned rel="icon", href="data:image/x-icon;base64,[my base 64 string]", and type="image/x-icon"

Nothing I've done with filepaths (or with the base 64 string) has resulted in anything other than Google Chrome's favicon placeholder. Any solution that works with filepaths or with base 64 would satisfy my requirement of being able to run without Internet connectivity.

I'm running R 4.0.2 with Windows 10 Pro OS on a 64-bit OS and launching into Google Chrome.

  • 1
    **www** must be a subfolder of the folder containing the Shiny app. This way is the right one. – Stéphane Laurent Aug 27 '20 at 23:20
  • Except www is a subfolder of the folder containing the Shiny app, and it holds nothing but the favicon.ico file (point three). Just to be sure, I restructured my Shiny app to inhabit a folder all its own containing just the global.R, ui.R, and server.R files and the www folder...and launching it from RStudio still doesn't work. I can give it a url and the online favicon will display, but I can get nothing from a local filepath (either a complete one 'C;/Users...' or one that begins www, or includes the .ico file name--nothing). – Non-Contradiction Aug 31 '20 at 21:09
  • I've checked my code. I'm using `rel = "shortcut icon"`, not `"icon"`. And this works. – Stéphane Laurent Sep 02 '20 at 13:44
  • I tried using "shortcut icon" with all of those filepath options for a www subdirectory and none of them worked. Is there a specific library or something that I should be including? – Non-Contradiction Sep 04 '20 at 17:11
  • Tried everything given online. Looks like there is no solution. :( – agent18 Oct 28 '20 at 21:56

0 Answers0