{"id":580,"date":"2011-07-27T13:04:50","date_gmt":"2011-07-27T05:04:50","guid":{"rendered":"http:\/\/blog.my0513.com\/?p=580"},"modified":"2011-07-27T13:11:57","modified_gmt":"2011-07-27T05:11:57","slug":"%e5%b0%8f%e9%ad%94%e9%ac%bc%ef%bc%9afavicon-ico","status":"publish","type":"post","link":"https:\/\/blog.my0513.com\/?p=580","title":{"rendered":"\u5c0f\u9b54\u9b3c\uff1afavicon.ico"},"content":{"rendered":"<p>\u5982\u679c\u4f60\u5e38\u5e74\u7ba1\u7406\u591a\u4e2a\u7f51\u7ad9\uff0c\u4f60\u603b\u4f1a\u9047\u5230favicon.ico\u8fd9\u4e2a\u5e7d\u7075\uff0c\u5b83\u4f4d\u4e8e\u7ad9\u70b9\u6839\u76ee\u5f55\u4e0b\u3002<\/p>\n<p>\u6240\u8c13favicon\uff0c\u5373Favorites Icon\u7684\u7f29\u5199\u3002\u6700\u521d\u5728IE4\u548cIE5\u5f53\u4e2d\uff0c\u5b83\u4e3b\u8981\u4f53\u73b0\u4e3a\u6536\u85cf\u5939\u5185\u4e00\u4e2a\u6709\u56fe\u6807\u7684\u6536\u85cf\u7f51\u9875\u3002<\/p>\n<p>\u81ea\u4ece\u6d4f\u89c8\u5668\u6807\u51c6\u5316\u83b7\u5f97\u5f88\u5927\u8fdb\u5c55\u4e4b\u540e\uff0c\u663e\u793a\u5f53\u524d\u7f51\u9875\u7279\u5f81\u7684favicon.ico\u5c0f\u56fe\u7247\u6210\u4e3a\u6807\u914d\uff0c\u4ee5\u81f3\u4e8e\u641c\u7d22\u5f15\u64ce\u7d22\u5f15\u6216\u8005\u6d4f\u89c8\u5668\u4e0b\u8f7d\u6587\u4ef6\u524d\uff0c\u90fd\u8981\u4e8b\u5148\u53bb\u5bfb\u627efavicon.ico\u6587\u4ef6\u3002<\/p>\n<p>favicon\u6587\u4ef6\uff0c\u53ef\u4ee5\u7f8e\u5316\u7f51\u9875\u5728\u6d4f\u89c8\u5668\u6216\u8005\u684c\u9762\u5feb\u6377\u65b9\u5f0f\u7684\u89c6\u89c9\u8868\u73b0\u3002\u7c7b\u4f3cGoogle\u3001\u767e\u5ea6\u3001facebook\u7684favicon\u6587\u4ef6\u51e0\u4e4e\u6bcf\u5929\u90fd\u5728\u6211\u4eec\u7684\u6d4f\u89c8\u5668\u680f\u6643\u60a0\u3002<\/p>\n<p>\u53ef\u662f\uff0c\u6709\u4e00\u4e2afavicon\u76f8\u5173\u7684\u95ee\u9898\uff0c\u8ba9\u7ad9\u957f\u4eec\u4e0d\u5927\u6109\u5feb\u3002\u5982\u679c\u4f60\u7684\u7ad9\u70b9\u57df\u540d\u7ecf\u8fc7\u591a\u5e74\u8fd0\u884c\u9700\u8981\u8c03\u6574\u57df\u540d\uff0c\u6bd4\u5982302\u4e34\u65f6\u6216301\u6c38\u4e45\u8df3\u8f6c\uff0c\u4f60\u4f1a\u53d1\u73b0\u4e00\u4e2a\u4ee4\u4eba\u90c1\u95f7\u7684\u60c5\u51b5\u3002\u4e00\u4e2a\u65e7\u7684favicon\u6807\u5fd7\u53ef\u80fd\u4f1a\u5728\u4f60\u7684\u7535\u8111\u91cc\u9762\u9057\u7559\u5f88\u4e45\uff0c\u4f60\u751a\u81f3\u4e0d\u80fd\u901a\u8fc7\u5237\u65b0\u6d4f\u89c8\u5668\u7f13\u5b58\u8fdb\u884c\u66f4\u65b0\u3002\u8fd9\u6709\u70b9\u50cf\u4ee5\u6536\u85cf\u7f51\u7edc\u9057\u4ea7\u77e5\u540d\u7684way machine\uff0c\u8fd9\u4e2a\u7f51\u7ad9\u5c06\u4e16\u754c\u4e0a\u5927\u591a\u6570\u516c\u5f00\u7f51\u7ad9\u5386\u5e74\u6765\u7684\u8d44\u6599\uff08\u5305\u62ecfavicion\u5728\u5185\uff09\u90fd\u4e00\u80a1\u8111\u8fdb\u884c\u6536\u85cf\uff0c\u800c\u4f60\u4f60\u53ef\u80fd\u6839\u672c\u4e0d\u60f3\u8ba9\u90a3\u4e48\u4e45\u7684\u65e7\u8d44\u6599\u88ab\u4fdd\u7559\u3002<\/p>\n<p>\u80bf\u95e8\u529e\uff1f\u7b54\u6848\u662f\u6307\u5b9a\u6587\u4ef6\u7c7b\u578b\u5e76\u8bbe\u7f6e\u7f13\u5b58\u3002<\/p>\n<p>\u8fd9\u91cc\u770b\u5230\u4e00\u4e2a\u4e0d\u9519\u7684\u6587\u6863\uff1a<\/p>\n<h3 id=\"favicon\"><\/h3>\n<p><!--more--><\/p>\n<blockquote>\n<h3 id=\"favicon\">Make favicon.ico Small and Cacheable<\/h3>\n<p>tag: images<\/p>\n<p>The favicon.ico is an image that stays in the root of your server. It&#8217;s a necessary evil because even if you don&#8217;t care about it the browser will still request it, so it&#8217;s better not to respond with a <code>404 Not Found<\/code>. Also since it&#8217;s on the same server, cookies are sent every time it&#8217;s requested. This image also interferes with the download sequence, for example in IE when you request extra components in the onload, the favicon will be downloaded before these extra components.<\/p>\n<p>So to mitigate the drawbacks of having a favicon.ico make sure:<\/p>\n<ul>\n<li>It&#8217;s small, preferably under 1K.<\/li>\n<li>Set Expires header with what you feel comfortable (since you cannot rename it if you decide to change it). You can probably safely set the Expires header a few months in the future. You can check the last modified date of your current favicon.ico to make an informed decision.<\/li>\n<\/ul>\n<p><a href=\"http:\/\/www.imagemagick.org\/\">Imagemagick<\/a> can help you create small favicons<\/p>\n<p><a href=\"http:\/\/developer.yahoo.com\/performance\/rules.html#page-nav\">top<\/a><\/p>\n<p><!--more--><\/p><\/blockquote>\n<p>Firebug\u6709\u4e00\u4e2aYSlow\u7531Yahoo\u5f00\u53d1\uff0c\u9488\u5bf9favicon\u63d0\u51fa\u4e24\u70b9\u4f18\u5316\u6307\u5357\u30021\u662f\u6587\u4ef6\u5c3a\u5bf8\u5c3d\u91cf\u5c0f\uff0c1K\u4ee5\u5185\uff0c2\u662f\u8bbe\u7f6efavicon\u6587\u4ef6\u7684\u7c7b\u578b\u548c\u7f13\u5b58\u3002<\/p>\n<blockquote><p>\u5177\u4f53\u7684\u65b9\u6cd5\u662f\u8fd9\u6837\uff1a<\/p>\n<div>\n<p>If you&#8217;re using Apache, just add a MIME-Type for the favicon in your website&#8217;s .htaccess file or to Apache&#8217;s mime.types file:<\/p>\n<pre><code># Add Proper MIME-Type for Favicon AddType image\/x-icon .ico <\/code><\/pre>\n<p>Then, set the Expires header a few month(s) in the future:<\/p>\n<pre><code># Enable Apache's mod_expires Module ExpiresActive On ExpiresByType image\/x-icon \"access plus 1 month\" <\/code><\/pre>\n<p>After clearing your browser&#8217;s cache and reloading the page, you should see the favicon.ico file being served with the Cache-Control header being set to a date (specified in seconds) in the future:<\/p>\n<pre><code>Content-Type image\/x-icon Cache-Control: max-age=2592000 <\/code><\/pre>\n<p>For related information, see the YSlow documentation on <strong>Making Your favicon.ico Small and Cacheable<\/strong> at: <a href=\"http:\/\/developer.yahoo.com\/performance\/rules.html#favicon\" rel=\"nofollow\">http:\/\/developer.yahoo.com\/performance\/rules.html#favicon<\/a><\/p>\n<\/div>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u679c\u4f60\u5e38\u5e74\u7ba1\u7406\u591a\u4e2a\u7f51\u7ad9\uff0c\u4f60\u603b\u4f1a\u9047\u5230favicon.ico\u8fd9\u4e2a\u5e7d\u7075\uff0c\u5b83\u4f4d\u4e8e\u7ad9\u70b9\u6839\u76ee\u5f55\u4e0b\u3002 \u6240\u8c13favicon\uff0c\u5373 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[56],"class_list":["post-580","post","type-post","status-publish","format-standard","hentry","category-32","tag-56"],"_links":{"self":[{"href":"https:\/\/blog.my0513.com\/index.php?rest_route=\/wp\/v2\/posts\/580","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.my0513.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.my0513.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.my0513.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.my0513.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=580"}],"version-history":[{"count":3,"href":"https:\/\/blog.my0513.com\/index.php?rest_route=\/wp\/v2\/posts\/580\/revisions"}],"predecessor-version":[{"id":582,"href":"https:\/\/blog.my0513.com\/index.php?rest_route=\/wp\/v2\/posts\/580\/revisions\/582"}],"wp:attachment":[{"href":"https:\/\/blog.my0513.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=580"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.my0513.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=580"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.my0513.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=580"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}