4

I am using Vaadin 20 Flow (Java) and want to assign an icon/image (.ico or .png) to my web app. This icon should be displayed besides the page title and should be used as an icon when the page is bookmarked.

I know that it was possible to assign these icons through implementing the interface PageConfigurator. However, this functional interface is now deprecated. Does anyone know how to implement such a favicon in the new Vaadin versions?

Felix Seifert
  • 552
  • 1
  • 9
  • 19

1 Answers1

5

Use AppShellConfigurer:

AppShellConfigurator is a replacement of the obsolete PageConfigurator interface.

public class AppShell implements AppShellConfigurator {

  @Override
  public void configurePage(AppShellSettings settings) {
    // ...
    settings.addFavIcon("icon", "icons/icon-192.png", "192x192");
    settings.addLink("shortcut icon", "icons/favicon.ico");
    // ...
  }
}
cfrick
  • 35,203
  • 6
  • 56
  • 68
  • Nice and fast answer. I tried your solution and I my icon shows up besides the page title in the opened tabs. However, it is not used as an icon for the bookmarks. Do you (or someone else) know which other tweaks might be required? – Felix Seifert Jun 13 '21 at 18:18
  • 1
    Found out that this bookmark icon issue is browser related. Somehow my installation of the Brave browser is not suitable for website development. Both Firefox and Chrome show the icon besides the title in a tab and in the bookmarks. The suggested implementation works smoothly. – Felix Seifert Jun 13 '21 at 19:15