Html 在网站中添加多个favicon的任何可能方式
如何为不同的浏览器添加多个favicon 原因: [Google Chrome]favicon在横轴上与页面标题完美匹配,使“at Drive”成为一个完整的句子 [Mozilla Firefox]现在您可以看到“相同的favicon”未命中匹配水平轴,它向下移动了一点 我想要的是:Html 在网站中添加多个favicon的任何可能方式,html,css,cross-browser,Html,Css,Cross Browser,如何为不同的浏览器添加多个favicon 原因: [Google Chrome]favicon在横轴上与页面标题完美匹配,使“at Drive”成为一个完整的句子 [Mozilla Firefox]现在您可以看到“相同的favicon”未命中匹配水平轴,它向下移动了一点 我想要的是: 在网站中插入与浏览器相关的多个Favicon图标 我想不出任何纯html/css解决方案,但您可以通过JavaScript将favicon更改为specify browser 例如,检测浏览器是否为firefo
在网站中插入与浏览器相关的多个Favicon图标 我想不出任何纯html/css解决方案,但您可以通过JavaScript将favicon更改为specify browser 例如,检测浏览器是否为firefox(),然后为其设置different favicon(),这样最终代码应该如下所示
<link id="favicon" rel="shortcut icon" type="image/png" href="favicon.png" />
<script type="text/javascript">
if (/firefox/i.test(navigator.userAgent)) {
document.getElementById("favicon").href = "favicon-firefox.png";
}
</script>
if(/firefox/i.test(navigator.userAgent)){
document.getElementById(“favicon”).href=“favicon firefox.png”;
}
我想不出任何纯html/css解决方案,但您可以通过JavaScript将favicon更改为specify browser
例如,检测浏览器是否为firefox(),然后为其设置different favicon(),这样最终代码应该如下所示
<link id="favicon" rel="shortcut icon" type="image/png" href="favicon.png" />
<script type="text/javascript">
if (/firefox/i.test(navigator.userAgent)) {
document.getElementById("favicon").href = "favicon-firefox.png";
}
</script>
if(/firefox/i.test(navigator.userAgent)){
document.getElementById(“favicon”).href=“favicon firefox.png”;
}
我从未尝试过此操作,但您可以尝试使用脚本根据发出请求的浏览器动态创建favicon。我从未尝试过此操作,但您可以尝试使用脚本根据发出请求的浏览器动态创建favicon。