开发者

Favicon doesn't display in IE and Chrome

I'm really puzzled about why my favicon doesn't show up in either IE9 or Chrome. 开发者_JAVA百科It does show in Firefox though. I've used favicons before and never had such troubles, and my code is quite trivial:

<!DOCTYPE HTML>
<html>
<head>
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
</head>
<body>

</body>
</html>

The file favicon.ico I use is directly taken from Wikipedia (for testing purpose to be sure it's not a faulty ICO file) and put in the same folder as the HTML file. I tried clearing the browser's caches and restarting them, but nothing works. Also, this is not on a web server, I open the HTMLs directly from the file system.


Also add another tag to make it like this for increased browser coverage:

<LINK REL="icon" HREF="favicon.ico" TYPE="image/x-icon">
<LINK REL="shortcut icon" HREF="favicon.ico" TYPE="image/x-icon"> 


I get favicons to work in Chrome with

<html>
<head>
<link rel="shortcut icon" href="/myapp/img/favicon.ico" />
</head>
</body>

Maybe strip the TYPE attribute?


Clear your history.

Hit the file directly first in your browser address bar.

Then remove your whole line since by default it looks at the root for that file.


Try this (with slash):

<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />

This should work


Make sure it's an actual icon file and not a bmp/jpg/png saved as .ico,

use this if it helps:

http://www.favicon.cc/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜