Creating Your First Manifest
You'll learn how to create a basic manifest.json file with essential properties and link it to your HTML document.
The Core Idea
A Web App Manifest is a JSON file that describes your Progressive Web App to the browser and operating system. You've already learned what it is—now it's time to build one. The manifest file lives separately from your HTML and must be linked using a <link> element in your page's <head>.
Think of it like a business card for your web app: it tells browsers the app's name, colors, icon, and how it should launch when installed on a device.
Creating the Manifest File
Create a file named manifest.json in your project root (or a dedicated folder like /public):
{
"name": "My Progressive Web App",
"short_name": "MyPWA",
"start_url": "/",
"display": "standalone",
"background_color": "#ffffff",
"theme_color": "#2196F3",
"icons": [
{
"src": "/icon-192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/icon-512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
Linking the Manifest in HTML
Add this <link> tag inside your HTML <head>:
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My PWA</title>
<link rel="manifest" href="/manifest.json">
</head>
The rel="manifest" attribute tells the browser where to find your manifest file.
Key Takeaway: A basic manifest requires a JSON file with name, short_name, start_url, display, colors, and icons, linked in your HTML's <head> with <link rel="manifest">.