动态更新的网站图标在Firefox书签中不起作用

Dynamically updated favicon not working in Firefox bookmarks

提问人:GeForce RTX 4090 提问时间:6/14/2023 最后编辑:TylerHGeForce RTX 4090 更新时间:11/17/2023 访问量:103

问:

我正在构建一个网站,该网站在从 rest API 加载其配置后为自己设置图标。该配置包含网站图标 src URL。

如果我像这样在脑海中对图标进行硬编码,它就可以工作:

<link rel="shortcut icon" href="https://my-favicon-storage.com/favicon.png">

enter image description here

但是,如果我像这样动态更新,它就不起作用了:

<link rel="shortcut icon" href="">

const faviconLink = document.querySelector("link[rel='shortcut icon']");
faviconLink.href = customFaviconSrc; // https://my-favicon-storage.com/favicon.png - url from the config loaded from rest API

enter image description here

如何使这个动态设置的网站图标在Firefox的书签中工作?

Javascript HTML iPhone 火狐浏览器

评论

0赞 Roko C. Buljan 6/14/2023
您可以在 bugzilla.org 上报告该问题(?) - PS:如果您至少使用,则初始图标显示在书签中。faviconLink.setAttribute("href", customFaviconSrc);

答: 暂无答案