useFavicon
A hook that set the favicon of the page.
Overview
A hook that set the favicon of the page.
Installation
Open inpnpm dlx shadcn@latest add https://shadcn-ahooks.vercel.app/r/useFavicon.jsonnpx shadcn@latest add https://shadcn-ahooks.vercel.app/r/useFavicon.jsonyarn shadcn@latest add https://shadcn-ahooks.vercel.app/r/useFavicon.jsonbun shadcn@latest add https://shadcn-ahooks.vercel.app/r/useFavicon.jsonA hook that set the favicon of the page.
Example
Basic Usage
API
useFavicon(href: string);Params
| Params | Description | Type | Default |
| | -- | -- | - |
| href | favicon URL, support svg/png/ico/gif | string | - |
FAQ
It doesn't work in Safari?
Safari cannot set the favicon dynamically.
Apple intentionally do not want the ability to script favicons. See https://bugs.webkit.org/show_bug.cgi?id=95979#c2
Related issues: #2126