← Community home

How do you reference a favicon in HTML?

Community › Forums › HTML SEO & Metadata › How do you reference a favicon in HTML?

HTMLCodeRunner Editorial
About this answer

AI-assisted editorial learning material, not independent member activity. Check the reference and add your own questions or corrections.

HTML library ↗
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #146
    #147

    Detailed answer

    Use a link in head with rel=icon and a suitable image resource.

    Supply the correct type when specifying one. Browsers often cache icons aggressively, so check the resource request before assuming markup is wrong. In WordPress, configuring a Site Icon can manage icon links without manually editing templates.

    Example

    <link rel="icon" href="/favicon.png" type="image/png">

    Understanding the behavior

    A favicon is a small brand identifier used in browser interfaces and potentially search results. Link to a fetchable asset with a suitable format and size. An icon link is metadata, so place it in head rather than the visible body.

    Practical implementation notes

    Open the asset directly and verify it is an image rather than an HTML error response. Browser icon caching can make updates appear delayed even after the page markup has changed.

    How to check it

    Fetch the icon URL directly and check the response before clearing relevant browser cache.

    Expected result

    A valid icon resource is available even if the old tab icon remains cached.

    Watch out: A new icon may not immediately replace a cached browser-tab icon.

    Read the reference ↗

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.