3

我想这个问题的答案是一个很大的否定,但是,为了确定,我在这里问:

图标是否<link rel="apple-touch-icon*总是由浏览器加载(我的意思是,也不是 iOS 浏览器)?

4

2 回答 2

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

然后,我访问了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 在第一次加载时会加载一些图标,但在访问引用相同图片的另一个页面时不会再次加载图标。

安卓 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

导航到第 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"

点击“分享”按钮

什么都没发生。同样,这是正常的,图标已经加载。

安卓火狐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"
于 2014-07-25T10:30:56.107 回答
2

不,浏览器不会遵循他们无法识别的链接类型。

于 2014-07-24T10:49:48.120 回答