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?
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).
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.
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.
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).
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With