local (file://) website favicon works in Firefox, not in Chrome or Safari- why?

后端 未结 7 1402
-上瘾入骨i
-上瘾入骨i 2020-11-27 18:15

The Question

When my website is local (using the file:// protocol), the favicon doesn\'t show up in Chrome or Safari, but it works in Firefox (all on a

相关标签:
7条回答
  • 2020-11-27 18:43

    This is a known issue for years. Your code is right, and I don't think you'll find any way to allow Chrome or IE to include a favicon with a non-remotely way.

    Some time ago, I tried a lot of ways, none works, and I wasn't able to find any browser documentation on this point.

    <link rel="icon" href="favicon.ico" type="image/x-icon" />
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
    <link rel="shortcut icon" href="favicon.png" type="image/png" />
    <link rel="shortcut icon" href="C:/files/favicon.ico" type="image/x-icon" />
    <link rel="shortcut icon" href="file:///C:/files/favicon.ico" type="image/x-icon" />
    <link rel="shortcut icon" href="file:///C|/files/favicon.ico" type="image/x-icon" />
    <link rel="shortcut icon" href="file://localhost/C:/favicon.ico" type="image/x-icon" />
    <link rel="shortcut icon" href="file://127.0.0.1/C:/favicon.ico" type="image/x-icon" />
    <link rel="shortcut icon" href="file://localhost/C|/favicon.ico" type="image/x-icon" />
    

    For Chrome, favicons are stored in a file : User\AppData\Local\Google\Chrome\User Data\Default\Favicons. We can guess local favicons aren't stored in.

    0 讨论(0)
提交回复
热议问题