我想这个问题的答案是一个大大的NO,但是,为了确定,我在这里问:
像<link rel="apple-touch-icon*
这样的图标总是被浏览器加载吗(我的意思是,也不是iOS浏览器)?
No。浏览器只在第一次加载时加载Apple Touch图标。
我在RealFaviconGenerator的帮助下创建了两个几乎相同的页面(完全披露:我是这个网站的作者),并通过Apache提供服务。page1.html
包含:<html>
<head>
<link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="76x76" href="/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png">
<link rel="icon" type="image/png" href="/favicon-196x196.png" sizes="196x196">
<link rel="icon" type="image/png" href="/favicon-160x160.png" sizes="160x160">
<link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16">
<link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32">
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="msapplication-TileImage" content="/mstile-144x144.png">
</head>
<body>
<h1>Page 1</h1>
</body>
</html>
page2.html
与h1
相同,
然后,我访问了page1.html
,然后访问了page2.html
,并检查了Apache的日志以检查HTTP访问。以下是我的发现。
Windows Chrome 36.0.1985.125 m
导航到第1页
"GET /page1.html HTTP/1.1" 200 662 "-" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36"
"GET /favicon-32x32.png HTTP/1.1" 304 179 "-" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36"
"GET /favicon-16x16.png HTTP/1.1" 304 179 "-" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36"
导航到第2页
"GET /page2.html HTTP/1.1" 200 662 "-" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36"
所以Chrome加载一些图标在第一次加载,但不加载图标再次当它访问另一个页面引用相同的图片。
Android Chrome 36.0.1.1985.128
导航到第1页
"GET /page1.html HTTP/1.1" 200 662 "-" "Mozilla/5.0 (Linux; Android 4.4.2; SM-G900F Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.128 Mobile Safari/537.36"
"GET /favicon-160x160.png HTTP/1.1" 200 5703 "-" "Mozilla/5.0 (Linux; Android 4.4.2; SM-G900F Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.128 Mobile Safari/537.36"
"GET /apple-touch-icon-144x144.png HTTP/1.1" 200 9889 "-" "Mozilla/5.0 (Linux; Android 4.4.2; SM-G900F Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.128 Mobile Safari/537.36"
导航到第2页
"GET /page2.html HTTP/1.1" 200 662 "-" "Mozilla/5.0 (Linux; Android 4.4.2; SM-G900F Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.128 Mobile Safari/537.36"
相同的行为。<标题> iOS7 Safari h1> 航到第1页
"GET /page1.html HTTP/1.1" 200 662 "-" "Mozilla/5.0 (iPad; CPU OS 7_1 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D167 Safari/9537.53"
换句话说,Safari在浏览时不加载任何图标。这是有道理的:它在界面中不显示任何图标。
点击"分享"按钮
(显示"添加到主屏幕"选项)
"GET /apple-touch-icon-152x152.png HTTP/1.1" 200 10313 "-" "MobileSafari/9537.53 CFNetwork/672.1.13 Darwin/14.0.0"
绝对有意义。
导航到第2页
"GET /page2.html HTTP/1.1" 200 662 "-" "Mozilla/5.0 (iPad; CPU OS 7_1 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D167 Safari/9537.53"
点击"分享"按钮
什么也不会发生。同样,这是正常的,图标已经加载。
Android Firefox 31.0
导航到第1页
"GET /page1.html HTTP/1.1" 200 662 "-" "Mozilla/5.0 (Android; Mobile; rv:31.0) Gecko/31.0 Firefox/31.0"
"GET /favicon-196x196.png HTTP/1.1" 200 13393 "-" "Mozilla/5.0 (Android; Mobile; rv:31.0) Gecko/31.0 Firefox/31.0"
导航到第2页
"GET /page2.html HTTP/1.1" 200 662 "-" "Mozilla/5.0 (Android; Mobile; rv:31.0) Gecko/31.0 Firefox/31.0"
标题>No。浏览器不会跟踪它们无法识别的链接类型。