如何在一个网站上创建2个Favicon

时间:2022-04-20 01:30:38

Is it possible to create 2 favicon in a site?

是否可以在网站中创建2个图标?

/images/favicon/favicon.ico" rel="icon">

So i'll be creating 2 homepage, the 2nd homepage will have different favicon. they only want to see which favicon is better.

所以我将创建2个主页,第2个主页将有不同的favicon。他们只想看看哪个图标更好。

1 个解决方案

#1


You can wow your customer:

你可以惊叹你的客户:

paste this before the closing </body> tag:

在结束 标记之前粘贴它:

<script>
var favicons = [
    "/images/favicon/favicon.ico",
    "/images/favicon/favicon2.ico"
];
var n = 0;
document.addEventListener("keyup", function(e){
    if(e.which===70) {
        var link = document.createElement('link');
        link.type = 'image/x-icon';
        link.rel = 'shortcut icon';
        link.href = favicons[++n%2];
        document.getElementsByTagName('head')[0].appendChild(link);
    }
}, false);
</script>

and tell them to hit F on the keyboard.

并告诉他们在键盘上按F键。


Said that, you can always create two favicons, favicon.ico and favicon2.ico, and call the desired one. I mean you don't have to call your image exactly favicon. Simply get the right one

说,你总是可以创建两个favicon,favicon.ico和favicon2.ico,并调用所需的。我的意思是你不必将你的形象称为精确的图标。只需找到合适的人选

indexTest1.html

<link rel="shortcut icon" href="/images/favicon/favicon.ico" type="image/x-icon" />

indexTest2.html

<link rel="shortcut icon" href="/images/favicon/favicon2.ico" type="image/x-icon" />

#1


You can wow your customer:

你可以惊叹你的客户:

paste this before the closing </body> tag:

在结束 标记之前粘贴它:

<script>
var favicons = [
    "/images/favicon/favicon.ico",
    "/images/favicon/favicon2.ico"
];
var n = 0;
document.addEventListener("keyup", function(e){
    if(e.which===70) {
        var link = document.createElement('link');
        link.type = 'image/x-icon';
        link.rel = 'shortcut icon';
        link.href = favicons[++n%2];
        document.getElementsByTagName('head')[0].appendChild(link);
    }
}, false);
</script>

and tell them to hit F on the keyboard.

并告诉他们在键盘上按F键。


Said that, you can always create two favicons, favicon.ico and favicon2.ico, and call the desired one. I mean you don't have to call your image exactly favicon. Simply get the right one

说,你总是可以创建两个favicon,favicon.ico和favicon2.ico,并调用所需的。我的意思是你不必将你的形象称为精确的图标。只需找到合适的人选

indexTest1.html

<link rel="shortcut icon" href="/images/favicon/favicon.ico" type="image/x-icon" />

indexTest2.html

<link rel="shortcut icon" href="/images/favicon/favicon2.ico" type="image/x-icon" />