Solution 1 :

Not inside the titlePanel but you can add following inside the ui:

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

Also you should put the image inside www folder.

Solution 2 :

As @phago29 indicated, one way to write it is:

  useShinyjs(),
  
  ## Window title
  tags$head(
    tags$link(rel = "icon", type = "image/png", sizes = "32x32", href = "myBrowserImage.png")),
  
  # App title ----
  titlePanel( title =  div(img(src="myAppImage.png"), 'myAppTitle'), windowTitle = "myBrowserTitle" ), 
  
  # Rest of the UI
) 

With the png images in a subfolder called “www”.

Problem :

I want to add a logo to the browser window in the same way as all browser windows are usually displayed:

enter image description here

titlePanel allows to add easily images to the application title, by using:
titlePanel(title = div(img(src="myAppImage.jpg"), "My App Name")
It is also possible to add the title that should be displayed by the browser window with windowTitle as a parameter.

However, it does not work when adding an image to the browser window. I tried:
titlePanel(title = div(img(src="myAppImage.jpg"), "My App Name"), windowTitle = div(img(src="myBrowserImage.png"), "My Browser Name")). But this gives the following browser name: <img src …>

What is the correct way of writing it?

By