Hello,
I would like to change favicon dynamically. Following solution works from Eclipse, but doesn’t work, when application is in war file:
[code]
class CheckFavicon implements Runnable {
private final static String faviconScript = "var link = document.createElement('link');\n"
+ "link.type = 'image/x-icon';\n"
+ "link.rel = 'shortcut icon';\n"
+ "link.href = './../VAADIN/themes/PSETheme/%s';\n"
+ "document.getElementsByTagName('head')[0]
.appendChild(link);";
@Override
public void run() {
for (Component component : tabSheet) {
if (StringUtils.contains(tabSheet.getTab(component).getStyleName(), "alert")) {
UI.getCurrent().access(() -> {
Page.getCurrent().getJavaScript().execute(String.format(faviconScript, "favicon-red.ico"));
});
return;
}
}
UI.getCurrent().access(() -> {
Page.getCurrent().getJavaScript().execute(String.format(faviconScript, "favicon.ico"));
});
}
}
[/code]Does it exist a way to change it from war file?