本文是记录favicon.ico在不同浏览器下的显示问题:
创建网页文件index.html
<html> <head> <title>icon test</title> <link rel="icon" href="Images/test.ico" type="image/x-icon" /> <link rel="shortcut icon" href="Images/test.ico" type="image/x-icon" /> </head> <body> body part </body> </html>
打开网页localhost:8080/index.html
360浏览器在浏览网页的时候,会忽略端口:
firefox请求的是:link 的href所对应的图标。
搜狗浏览器等:请求的是http://localhost:8080/favicon.ico.
360浏览器等:请求的是http://localhost/favicon.ico,
也就是不管你请求的是http://host/home.html,还是http://host:8080/home.html,还是http://host/test/index.html.
它请求的都是http://host/favicon.ico.
如果网站favicon.ico 不起作用,或者是想要让favicon.ico 的兼容性更好,解决方法:
1:检查网站根目录下面的favicon.ico,也就是:http://host/favicon.ico.,而不是http://host/some/favicon.ico.
2:确保<link rel="icon" href="http://host/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="http://host/favicon.ico" type="image/x-icon" />
3:如果你的网站带端口,或者是测试版本的话,那么尤其要注意360等浏览器,它们在请求favicon.ico 的时候会忽略端口号的。
原文内容:http://blog.csdn.net/zhizaibide1987/article/details/42001955