Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force manifest.json to refresh on existing Android device

Within my PWA, I want to ensure any changes to the manifest.json file are forced to be applied to any device that either already has the PWA added to home screen or ensure Chrome does not cache the file so old settings are not used when adding to home screen

I've tried changing the name of the manifest file and the <link> value but this does not seem to work on the next visit

Is there a definitive way to ensure the up to date manifest file is used?

like image 555
Mike Avatar asked Jul 09 '18 18:07

Mike


People also ask

How do you reload manifest?

Fast and simple! First locate manifest. json file on the site, for example domain.com/manifest.json . Then make a hard refresh (on pc press ctrl and refresh button).

Should manifest JSON be cached?

Yes you should cache your manifest. json file, because if you a building a PWA, then it must have a functionality to Add to home screen . In your manifest file, it contains a start_url that needs to be cached by service worker and should return a 200 response when offline.

How do I run manifest JSON?

First check if manifest. json is applied in the browser. For that open developer window by pressing shortcut F12. In Application tab, click Manifest option and see if it displays information that you have set.

What is start_url in manifest JSON?

The start_url member is a string that represents the start URL of the web application — the preferred URL that should be loaded when the user launches the web application (e.g., when the user taps on the web application's icon from a device's application menu or homescreen).


1 Answers

In most cases, changes should be reflected within a day or two of the PWA being launched, after certain fields manifest file have been updated. There are minor differences between Chrome on desktop and Chrome on Android on which fields will trigger an update. One of the easiest things to do is change the icons or the theme_color.

The key point being that the user has to open the PWA, in order for Chrome to check if the manifest has been updated.

Full details are at How Chrome handles updates to the web app manifest

like image 148
PeteLe Avatar answered Oct 20 '22 03:10

PeteLe