5

I am writing a simple webpage located at the root directory of the server with a shortcut icon located at "/favicon.ico", but my browser never requests this favicon.ico. I have included the following in the html:

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

When I open up the network tab of the developer tools, I see the request for 192.168.0.1 (the webpage itself), but no subsequent request for the icon. Clearing the cache and enabling "disable cache" does nothing to change the behavior.

There are no errors appearing in the developer console and everything else seems to be working fine.

Edit:

I updated the link to the following as per the post by Jean-Francois and was still having the same issue:

<link href="favicon.ico" rel="icon" type="image/x-icon"/>
awaywardson
  • 111
  • 5
  • Answer is there: http://stackoverflow.com/questions/10218178/necessary-to-add-link-tag-for-favicon-ico See @Semanino's answer ! – Jean-Francois Demers Feb 22 '16 at 22:20
  • Thanks for the response. I got it working and will post the answer below. Turns out, once I got it working, that I reverted to the incorrect syntax originally posted, and chrome was able to handle that without erroring. – awaywardson Feb 23 '16 at 01:09

1 Answers1

6

Turns out the issue I had dealt with the caching of the icon as well as the way that I was detecting if the browser was actually requesting the icon.

I was just looking at the network log on chrome to determine if there was a request going out for favicon.ico and Favicon request not showing in network tab of developer toolbars shows that there is an issue with this.

And just doing hard refreshes (by forcing the browser to not use the cache) did not seem to fix the issue either, and the only way that I was able to get all three browsers to make the request was to add a query parameter to the end of the link. The final link tag was:

<link href="favicon.ico?v=1.0" rel="icon" type="image/x-icon"/>
Community
  • 1
  • 1
awaywardson
  • 111
  • 5