Favicon 不是第一次出现

Favicon not showing up for the first time

我构建了一个 AngularJS 单页应用程序,它工作正常,但有一个问题:当网站第一次加载时,favicon 没有出现。如果我重新加载页面,它最终会显示出来。它在我测试过的每个网络浏览器上都一样工作:Mozilla Firefox、Chrome、Chromium、IE 9、Android 浏览器、Safari for iPhone.

这是 SPA 的公共部分:

<!DOCTYPE html>
<html lang="en" data-ng-app="vannApp" >
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta content="Vanntile Ianito" name="author">
    <base href="file:///home/vanntile/Documents/doc/WEB_DEVELOPING/Vann_Original/index.html">

    <link rel="shortcut icon" href="icon/favicon.ico">
    <link rel="apple-touch-icon" sizes="57x57" href="icon/apple-touch-icon-57x57.png">
    <link rel="apple-touch-icon" sizes="60x60" href="icon/apple-touch-icon-60x60.png">
    <link rel="apple-touch-icon" sizes="72x72" href="icon/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="76x76" href="icon/apple-touch-icon-76x76.png">
    <link rel="apple-touch-icon" sizes="114x114" href="icon/apple-touch-icon-114x114.png">
    <link rel="apple-touch-icon" sizes="120x120" href="icon/apple-touch-icon-120x120.png">
    <link rel="apple-touch-icon" sizes="144x144" href="icon/apple-touch-icon-144x144.png">
    <link rel="apple-touch-icon" sizes="152x152" href="icon/apple-touch-icon-152x152.png">
    <link rel="apple-touch-icon" sizes="180x180" href="icon/apple-touch-icon-180x180.png">
    <link rel="icon" type="image/png" href="icon/favicon-32x32.png" sizes="32x32">
    <link rel="icon" type="image/png" href="icon/favicon-194x194.png" sizes="194x194">
    <link rel="icon" type="image/png" href="icon/favicon-96x96.png" sizes="96x96">
    <link rel="icon" type="image/png" href="icon/android-chrome-192x192.png" sizes="192x192">
    <link rel="icon" type="image/png" href="icon/favicon-16x16.png" sizes="16x16">
    <link rel="manifest" href="icon/manifest.json">

    <title>Website Title</title>

    <link href="css/vannstyle.min.css" rel="stylesheet">
    <script src="js/angular/angular.min.js"></script>
    <script src="js/angular/ui-bootstrap-tpls-0.12.1.min.js"></script>
    <script src="js/angular/angular-route.min.js"></script>
    <script src="js/angular/angular-animate.min.js"></script>
    <script src="js/angular/index.js"></script>

</head>
<body>
    <p>This is some text. I could have thought of something better, but I'm lazy.</p>
</body>
</html>

网站图标是用 Real favicon Generator. And the Microsoft tiles are made with: Windows 8.1 tile 制作的。它们不在网站的根目录中,而是在 /icon.

如有任何帮助,我们将不胜感激。提前谢谢你。

可能是网站图标没有放在网站的根目录下。尝试更改他们的文件夹,看看它是否仍然发生。

您必须将 favicon.ico 元标记放在网站图标元标记的第一个位置。以google页面为例:

<!DOCTYPE html>
<html lang="en" data-ng-app="vannApp" >
<head>
   <meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop="image">
   <link href="/images/branding/product/ico/googleg_lodp.ico" rel="shortcut icon">