我想这个问题的答案是一个很大的问题,但是,为了确定,我在这里问:
像<link rel="apple-touch-icon*
这样的图标是否总是由浏览器加载(我的意思是,也不是iOS浏览器)?
答案 0 :(得分:4)
否。浏览器仅在首次加载时加载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
的{{1}}相同。
然后,我访问了page1.html
,然后访问了page2.html
并检查了Apache的日志以检查HTTP访问。这是我发现的。
"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"
"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会在首次加载时加载一些favicons,但在访问引用相同图片的其他页面时不会再次加载图标。
"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"
"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"
同样的行为。
"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在浏览时不会加载任何图标。这是有道理的:它不会在界面中显示任何图标。
(显示&#34;添加到主屏幕&#34;选项)
"GET /apple-touch-icon-152x152.png HTTP/1.1" 200 10313 "-" "MobileSafari/9537.53 CFNetwork/672.1.13 Darwin/14.0.0"
绝对有道理。
"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"
什么都没发生。再次,这是正常的,图标已经加载。
"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"
"GET /page2.html HTTP/1.1" 200 662 "-" "Mozilla/5.0 (Android; Mobile; rv:31.0) Gecko/31.0 Firefox/31.0"
答案 1 :(得分:2)
没有。浏览器不会遵循他们不认识的链接类型。