将浏览器请求/favicon.ico或LT;链接>第一? [英] Will browsers request /favicon.ico or <link> first?

查看:312
本文介绍了将浏览器请求/favicon.ico或LT;链接>第一?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要设置为从静态文件服务器,而不是针对性能优化的主要Web服务器请求一个图标。

I want to set a favicon to be requested from a static file server instead of the main web server for performance optimization.

如果我指定<链接rel =快捷方式图标的href =htt​​p://cdn.site.com/favicon.ico> 也有一个 /favicon.ico 在我的网站根目录作为备用,这将浏览器preFER?将浏览器(和?)还在寻找 /favicon.ico ,使移动到一个静态文件服务器没用?

If I specify a <link rel="shortcut icon" href="http://cdn.site.com/favicon.ico"> but also have a /favicon.ico in my site root as a fallback, which will browsers prefer? Will browsers (and which?) still look for /favicon.ico, making the move to a static file server useless?

推荐答案

我没有测试上述建议。我把一个/favicon.ico在域的根,和一个链接,并在发射了页:

I did the test suggested above. I placed a /favicon.ico in the root of a domain, and a link, and fired up the page in:


  1. 歌剧院10

  2. 歌剧9.64

  3. 火狐3.5

  4. IE 6

  5. IE 7

  6. IE 8

  7. 的Safari 4

他们都表现出装有&LT图标,链接rel =快捷方式图标的href =htt​​p://cdn.site.com/favicon.ico&GT; (位于外部服务器上)。我检查的access.log ,并有到 /favicon.ico

They all showed the icon loaded with <link rel="shortcut icon" href="http://cdn.site.com/favicon.ico"> (located on an external server). I checked access.log, and there were no requests to /favicon.ico!

然后我注释掉&LT;链接&GT; ,在所有浏览器再次检查,他们表现出的 /favicon.ico 图标和相应的条目的access.log

I then commented out the <link>, checked again in all browsers, and they showed the /favicon.ico icon and corresponding entries in access.log.

这篇关于将浏览器请求/favicon.ico或LT;链接&GT;第一?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆