Is putting your favicon.ico file in a non-root path a bad idea?

后端 未结 1 1827
无人共我
无人共我 2020-12-13 12:07

When and how do browsers request the favicon.ico file? Do they always check for it in root, or do they read the content of the webpage first to see if the page specifies the

相关标签:
1条回答
  • 2020-12-13 12:22

    Remember that not all requests to your site are for HTML pages! Requests for non-HTML content, like bare image files (e.g, viewing http://example.com/image.jpeg directly in the browser), cannot see a <link> tag. Therefore, they must fall back to searching for the shortcut icon in the standard location at /favicon.ico.

    This still doesn't mean that this needs to be the canonical location, though! You can still keep it in /images/favicon.ico if you want - just make sure that a redirect is in place from /favicon.ico to wherever your preferred location is.

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