public>index.html
<head>
<link rel="shortcut icon" type="image/x-icon" href="./aa.png">
</head>
<script>
(function() {
var newHostname=window.location.hostname;
console.log('hostName',newHostname);
if(newHostname.indexOf('bb')!==-1){ // 包含bb域名, 换logo
var link = document.querySelector("link[rel*='icon']") || document.createElement('link');
link.type = 'image/x-icon';
link.href = './bb.png';
link.rel = 'shortcut icon';
document.getElementsByTagName('head')[0].appendChild(link);
}
})();
</script>
vue 动态更换网页icon
最新推荐文章于 2024-05-01 01:20:57 发布