Are there any restrictions on naming the favorites icon (favicon) file as anything other than favicon.ico?
I know for sure that it can be named anything, as long as the favicon tag refers to the correct file name.
For example:
<link href="/somefile.ico" type="image/x-icon" rel="icon" />
<link href="/somefile.ico" type="image/x-icon" rel="shortcut icon" />
The code above works just fine in displaying the icon.
What I want to know is does this violate any W3C/HTML specifications or this is permitted usage?
I know for sure that it can be named anything, as long as the favicon tag refers to the correct file name. The code above works just fine in displaying the icon.
In my case, it was fixed by moving the favicon. ico to the same place as my Html file. Obviously, you should change the icon path too.
Most browsers look for the existence of an file called favicon. ico at the root path of your website domain, this controls the icon for the website you can see in your bookmarks folder or the address bar of your browser. If you don't have one, then it's valid that it would return a Not Found error.
To add a favicon to your website, either save your favicon image to the root directory of your webserver, or create a folder in the root directory called images, and save your favicon image in this folder. A common name for a favicon image is "favicon.ico".
According to W3C, the preferred method is to actually specify the favicon in the html document rather than relying on favicon.ico in the server root.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With