Page 1 of 1

Missing Favicon for Syncthing GUI

Posted: 2021-04-25, 16:45
by mopani
Windows 10 Pro 20H2, Pale Moon desktop/32 v29.1.1

Pale Moon is not loading the (dynamic) favicon for the Syncthing GUI. Confirmed this with a fresh Pale Moon profile and fresh install of Syncthing.

The favicon is dynamic based on scripting, but it appears that Pale Moon does not update the favicon after initially loading the page (the tab and URL bar only ever show the generic moon icon, the favicon never resolves). This is the case both for localhost browsing (http & https) and public (https) IP/URL installations.

The html source for the Syncthing GUI shows this for the favicon entry:

Code: Select all

<link rel="shortcut icon" href="assets/img/favicon-{{syncthingStatus()}}.png"/>


Chrome displays the favicon appropriately on first load and as it updates. FireFox fails to load the favicon initially, but it does update the tab and URL bar icon once the page has loaded.

See the workaround posted at https://forum.syncthing.net/t/fixing-sy ... efox/15726 for details.

Re: Missing Favicon for Syncthing GUI

Posted: 2021-04-25, 20:33
by Moonchild
This isn't a bug; you're designing something around a specific Chrome-ism.
GUI favicons are not part of web content and are cached separately, for one. They also can't be treated as if they were part of web content since they are just meta data in the HTML. The components of an HTML document are loaded and parsed before any script is executed so it is correct that

Code: Select all

<link rel="shortcut icon" href="assets/img/favicon-{{syncthingStatus()}}.png"/>
does not show a later-dynamically-replaced icon.

If you want to replace the favicon then you have to do so through DOM manipulation which should work just fine. e.g. (not tested):

Code: Select all

const favicon = document.querySelector('[rel=icon]');

function eventHandler(yourEvent) {
  favicon.href = "https://link.to/yourdynamicfavicon.ico";
}
The main <link> element should have a valid temporary/generic icon listed.

That should be cross-browser compatible, but even so, there's no guarantee that anything will be updated dynamically because, as said, the GUI isn't part of page content.

Re: Missing Favicon for Syncthing GUI

Posted: 2021-04-26, 16:10
by mopani
Thanks for the clear explanation.

I've filed a bug with Syncthing for this very fix (valid image in the initial HTML).