我有一个由两个不同的网站图标引用组成的 HTML 页面,我想用第一个覆盖第二个图标 (favicon2)。 即:
<head>
<link rel="shortcut icon" href="/assets/images/favicon1.ico" type="image/x-icon" />
<link rel="shortcut icon" href="/assets/images/favicon2.ico" type="image/x-icon" />
</head>
在 Firefox favicon2 中显示,但在 Chrome 和 IE favicon1 中显示,如何使 Chrome 显示 favicon2?
请帮帮我这个。我被困住了。
提前致谢
在文件夹的根目录中添加您的收藏夹图标,并将网址路径更新为网站图标。
function myFunction() {
document.getElementById('myIcon').href = "favicon2.ico";
}
<!DOCTYPE html>
<html>
<head>
<link id="myIcon" rel="shortcut icon" href="favicon1.ico" type="image/x-icon" />
</head>
<body>
<p>Click the button to change the value of the src attribute of the icon.</p>
<button onclick="myFunction()">Try it</button>
</body>
</html>