html - Google Chrome 中不显示网站图标

标签 html google-chrome favicon

我已经访问过这些问题,但没有一个答案对我有用:

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/

相关文章:

html - 下载属性在 safari 中不起作用

javascript - 用于通知的动画图标

PHP - 获取站点的图标并在必要时将其转换为 png

iis - 如何让 IIS 为我的 favicon.ico 发布缓存 header ?

php - 使用 PHP 从混合的纯文本和 HTML 文本创建 PDF

javascript - 如何使用复选框插件通过多选下拉列表来过滤剑道 ui 网格

html - CSS Image size auto 使跟踪像素显示为丢失的图像

javascript - JQuery 在 Chrome 中无法运行,但在 Firefox 中可以正常运行

css - 如何自定义(更改颜色、字体、图像等设计)Google Chrome 自定义导航

javascript - 如何运行我自己的代码与浏览器交互?