简体   繁体   中英

Displaying a Favicon using recommended code is not working

I have "Googled" this quite a bit in the past hour.

I am working on a new website, and I've never used favicons before (I always forget about them). So, the first place I looked was Google, and the first result that came up was this one:

How To Add A Favicon To Your Site (W3.org)

And after trying out the first two options, and re-uploading the files to the server I have found that neither of the snippets of code on that page listed above work for me. I have double-checked that all references to the favicon are correct and that all files are in the right places. I have even tried using a .PNG file instead of an actual icon ( .ico), which I have seen in use on other sites.

Then, I went back to Google and looked at a few more sites, and tried the code in those tutorials. It worked! Well, kind of... It worked in Flock web browser, FireFox, and Chrome. But it didn't work in Internet Explorer 9, 8, 7, or 6.

I then came over here to S/O, and "View Source"'d the homepage and used their favicon code and that still didn't work!

Here's the latest piece of code that I have now:

<link rel="shortcut icon" href="http://mywebsite.com/favicon.ico">

What is the most reliable way of ensuring my Favicon displays in every browser?



Updates


  1. Tried Bookmarking the page - Didn't work.

Check the permissions to your .ico/.png file. I had the same problem once. So I went to http://my-url/my-favicon.ico and I got "Permission Denied" error.

I did chmod 644 to my-favicon.ico and it worked. :)

Favicons are really annoying to recieve because they cache. Try using another computer and navigating to domain.com/favico.(png/ico)

Here is code

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

For more detail about favicon please check

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM