Garrett Catlin

February 27, 2023

Browser Icons in R Shiny

One nice-to-have feature in a webpage is a little browser icon. And we can certainly achieve this with an R Shiny application. You'll just need the PNG file you want to use as your icon! I'll be using my Generic Navbar Page app as a reference here, and its icon can be found in the Github if you need a quick example.

You'll need to place your icon inside your www folder (this normally contains your .css file and any other additional imports for your app, such as an icon).
Screenshot 2023-02-23 at 1.29.25 PM.png

All that's needed from there is to insert the following line into your UI, swapping "icon.png" for whatever your filename is:

tags$head(tags$link(rel = "icon", type = "image/png", href = "icon.png"))

You then should this icon as the browser icon when you open your app in a browser:
Screenshot 2023-02-23 at 1.26.47 PM.png

Icon-ic!
groan.gif

Cheers,

Garrett C.

About Garrett Catlin

Your friendly neighborhood data scientist.