I have build an AngularJS Single Page Application and it works fine, but it has one problem: when the website loads for the first time, the favicon does not appear. If I reload the page, it finally shows up. It works the same on every web browser where I have tested: Mozilla Firefox, Chrome, Chromium, IE 9, Android browser, Safari for iPhone.
我已经构建了一个AngularJS单页面应用程序,它工作正常,但它有一个问题:当网站第一次加载时,不会出现图标。如果我重新加载页面,它最终会显示出来。它在我测试过的每个网络浏览器上都是一样的:Mozilla Firefox,Chrome,Chromium,IE 9,Android浏览器,Safari for iPhone。
This is the common part of the SPA:
这是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>
The favicons are made with Real favicon Generator. And the Microsoft tiles are made with: Windows 8.1 tile. They are not in the root of the website but in /icon.
这些favicons是用Real favicon Generator制作的。而微软的瓷砖是用:Windows 8.1瓷砖制作的。它们不在网站的根目录中,而是在/ icon中。
Any help would be appreciated. Thank you in advance.
任何帮助,将不胜感激。先谢谢你。
2 个解决方案
#1
5
You must have put the favicon.ico meta tag the first from the favicon meta tags. Check the google page as an example:
您必须将favicon.ico元标记放在favicon元标记的第一个标记中。以谷歌页面为例:
<!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">
#2
2
It may be that the favicon is not placed in the root of the site. Try changing their folder and see if it still happens.
可能是favicon没有放在网站的根目录中。尝试更改其文件夹,看看它是否仍然存在。
#1
5
You must have put the favicon.ico meta tag the first from the favicon meta tags. Check the google page as an example:
您必须将favicon.ico元标记放在favicon元标记的第一个标记中。以谷歌页面为例:
<!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">
#2
2
It may be that the favicon is not placed in the root of the site. Try changing their folder and see if it still happens.
可能是favicon没有放在网站的根目录中。尝试更改其文件夹,看看它是否仍然存在。