我已经访问过这些问题,但没有一个答案对我有用:
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 中不起作用。有什么想法吗?
最佳答案
您的 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"> -->
关于html - Google Chrome 中不显示网站图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21296044/