提问人:GeForce RTX 4090 提问时间:6/14/2023 最后编辑:TylerHGeForce RTX 4090 更新时间:11/17/2023 访问量:103
动态更新的网站图标在Firefox书签中不起作用
Dynamically updated favicon not working in Firefox bookmarks
问:
我正在构建一个网站,该网站在从 rest API 加载其配置后为自己设置图标。该配置包含网站图标 src URL。
如果我像这样在脑海中对图标进行硬编码,它就可以工作:
<link rel="shortcut icon" href="https://my-favicon-storage.com/favicon.png">
但是,如果我像这样动态更新,它就不起作用了:
<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
如何使这个动态设置的网站图标在Firefox的书签中工作?
答: 暂无答案
评论
faviconLink.setAttribute("href", customFaviconSrc);