我已经访问了这些问题,但没有一个答案对我有用:
Why doesn't my fav icon work in Chrome any more?
Chrome doesn't show the favicon
我的网站是http://mikeyaworski.com,这是我用来设置图标的代码:
<head>
<title>mikeyaworski</title>
<link
rel="shortcut icon"
href="http://mikeyaworski.com/myicon.ico"
type="image/vnd.microsoft.icon"
>
</head>
这是我的entire code。
而不是rel="shortcut icon"
我尝过rel="icon"
而不是type="image/vnd.microsoft.icon"
我尝过type="image/x-icon"
而不是href="http://mikeyaworski.com/myicon.ico"
我尝过href="myicon.ico"
该图标适用于Mozilla和Internet Explorer。该图标在Google Chrome中无法使用。有什么想法吗?
答案 0 :(得分:5)
您的HTML无效,浏览器会尝试修复它。这样做你的链接标记最终会被忽略,修复你的HTML并且它会起作用
<!DOCTYPE>
<html>
<head>
<title>mikeyaworski</title>
<link rel="icon" href="myicon.ico" type="image/vnd.microsoft.icon">
</head>
<body> <!-- body tag should be here -->
<h1 style="text-align:center;font-family:trebuchet ms;" id="top"><br><br>Hompage</h1>
<p>
Coming soon. Until then, view my <a href="http://stackoverflow.com">StackOverflow</a> and other StackExchange profiles:
</p>
<a href="http://stackexchange.com/users/2644958">
<img src="http://stackexchange.com/users/flair/2644958.png?theme=dark" width="208" height="58" alt="profile for mike yaworski on Stack Exchange, a network of free, community-driven Q&A sites" title="profile for mike yaworski on Stack Exchange, a network of free, community-driven Q&A sites">
</a>
<body>
</html>
<!-- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> -->
答案 1 :(得分:0)
尝试使用以下代码:
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
或者其他人在下面的链接中进行类似的讨论:
local (file://) website favicon works in Firefox, not in Chrome or Safari- why?
更新: 或者尝试以下链接: Fix missing favicons on Google Chrome
希望这会有所帮助。 谢谢, Jatin