I am not sure why sometimes the favicon is not showing properly, or still using the old one even I have changed it. I am not sure if it's related to the cache issue, but I still couldn't get it right even if I have cleared the cache.
I had this issue when I am using an icon file with this code:
I changed it to PNG file, then it's fine. So, I just use the PNG file instead.