Progressive Web App – App Manifest

Welcome to Progressive Web App Series. If you have missed previous blog posts, please read from following links. In this blog post we will understand one of the important component of PWA, which is App Manifest, which is nothing but meta data about app.

  1. What Are Progressive Web Apps?
  2. Progressive Web App – App Shell

What is App Manifest?

The manifest allows developer to configure look and feel of PWA. For example if user saves it on home page, the icon will be displayed, that we can configure it in manifest. If you don’t add this file to PWA, user will not be able to save it on home page.

So you can configure app name, app icon, launch url etc. in this file. So user can distinguish it from other sites and apps. It’s JSON based file and following is the default structure of the file.

App Manifest

 

{
“name”: “PWA Demo”,
“short_name”: “PWA Demo”,
“icons”: [{
“src”: “images/pwaDemo.png”,
“sizes”: “192×192”,
“type”: “image/png”
}],
“start_url”: “/index.html”,
“display”: “standalone”,
“background_color”: “#3E4EB8”,
“theme_color”: “#2F3BA2″
}

After you create this file in your PWA, you have to link this to your html page. So browser will know about it and will use it’s metadata when users saves it on home page. Add following line to your head tag.

<link rel=”manifest” href=”/manifest.json”>

As you can see the structure of the manifest file, you can add title, short title and add number of icons. You can add different size of the icons for different mobile screens. For example for low resolution, you can add small icon.

{
“src”: “images/pwaDemo128.png”,
“type”: “image/png”,
“sizes”: “128×128”
}

Auto Generated Splash Screen

If you add above file in PWA and save it on home screen and open it, you will notice a splash screen coming up. That’s the magic of PWA. This splash screen is built with following things of manifest.

  • background_color
  • icon
  • name
  • theme_color

This splash screen will be displayed till its loading cached resources and other resources required to start the app.

The display property define the look and feel of app. If you set it as standalone, your app will be displayed in full screen and it you want top url bar to be displayed, you can set it as browser.

So by using this file, you can configure look and feel of your PWA app. In next post we will understand about service worker. You can also get more information about manifest from Google developers site.

Web Application Manifest

1 thought on “Progressive Web App – App Manifest”

  1. Pingback: Progressive Web App - Add Web Push Notification – Hiren's Technical Blog

Leave a Reply

Your email address will not be published. Required fields are marked *