HTML Favicon
In this page:
<link rel="icon" type="image/x-icon" href="favicon.ico">
Favicon क्या है?
favicon ('favorite icon' का संक्षिप्त रूप) एक बहुत छोटा graphic है जो किसी specific webpage या website से जुड़ा होता है। यह एक visual anchor की तरह काम करता है जो browser interface में आपके brand को represent करता है।
उदाहरण: What is a Favicon?
<!-- Favicon: the small icon shown in the browser tab -->
Favicon File Formats (ICO बनाम PNG बनाम SVG)
web के शुरुआती दिनों में, favicons को Microsoft ICO format में save करना पड़ता था। आज, modern ब्राउज़र PNG और scalable vector SVG formats को support करते हैं, जिससे कहीं अधिक sharp, translucent, और यहां तक कि responsive icons बनाना संभव है।
उदाहरण: Favicon File Formats (ICO vs. PNG vs. SVG)
<!-- favicon.ico, favicon.png, favicon.svg -->
अपने HTML में Favicon जोड़ना
favicon जोड़ने के लिए, आप अपने HTML document के head section के अंदर एक special link tag insert करते हैं। link tag को rel attribute icon पर set होना चाहिए और href attribute को आपके image path की ओर इशारा करना चाहिए।
- अपने favicon link tags हमेशा head section के अंदर लिखें, आदर्श रूप से title tag के ठीक बाद।
- Accepted attributes:
- rel — icon | shortcut icon (legacy) | apple-touch-icon
- href — icon file का URL
- type — MIME type जैसे image/png | image/svg+xml | image/x-icon
- sizes — WxH list (जैसे 32x32) | any
उदाहरण: Adding a Favicon to Your HTML
<head>
<title>My Page</title>
<link rel="icon" href="favicon.png">
</head>
Mobile Devices के लिए Apple Touch Icons
जब mobile users आपकी website को bookmark करते हैं या इसे सीधे अपने smartphone home screen पर जोड़ते हैं, तो standard favicons अक्सर धुंधले दिखते हैं। Apple ने उच्च-गुणवत्ता वाले home screen web clips देने के लिए apple-touch-icon format पेश किया।
- बेहतरीन apple-touch-icon layout के लिए एक solid background के साथ 180x180 pixel PNG बनाएं।
- Accepted attributes:
- rel — apple-touch-icon
- href — icon file का URL (PNG)
- sizes — जैसे 180x180
उदाहरण: Apple Touch Icons for Mobile Devices
<link rel="apple-touch-icon" href="apple-touch-icon.png">
Favicon Caching समस्याओं को प्रबंधित करना
network data बचाने के लिए वेब ब्राउज़र favicons को aggressively cache करते हैं। इसका मतलब है कि अगर आप अपने website logo icon को update करते हैं, तो users force browser refresh किए बिना हफ्तों तक पुराना version देखते रह सकते हैं।
उदाहरण: Managing Favicon Caching Issues
<link rel="icon" href="favicon.png?v=2">
PWA Manifest में Favicon Icons
जब किसी साइट को Progressive Web App के रूप में install किया जाता है, तो फोन की home screen पर दिखने वाले icons HTML head में favicon link tags से नहीं, बल्कि manifest.json के अंदर icons array से आते हैं।
ये manifest icons आमतौर पर एक सामान्य favicon से कहीं बड़े होते हैं, क्योंकि उन्हें पूरे home screen app icon के रूप में sharp दिखना होता है।
उदाहरण: Favicon Icons in the PWA Manifest
<link rel="manifest" href="manifest.json">
<!-- manifest.json icons array includes 192x192 and 512x512 sizes -->
Chapter Quiz — Complete all 26 topics to unlock
0/26 topics done
Complete these topics first:
- HTML Favicon
- HTML Page Title
- HTML Tables
- HTML Lists
- HTML Block & Inline
- HTML Comments
- HTML Colors
- HTML CSS
- HTML Links
- HTML Images
- HTML RGB Colors
- HTML HEX Colors
- HTML HSL Colors
- HTML Link Colors
- HTML Link Bookmarks
- HTML Background Images
- HTML Table Borders
- HTML Table Sizes
- HTML Table Headers
- HTML Table Padding & Spacing
- HTML Colspan & Rowspan
- HTML Table Styling
- HTML Table Colgroup
- HTML Unordered Lists
- HTML Ordered Lists
- HTML Other Lists / Description Lists