Should I cache manifest.json in the service

I use a service worker. Should I cache my manifest.json. It makes sense? Also how often the browser retrieves this file.

+4
source share
2 answers

Yes, you have to cache your manifest.json file, because if you create PWA, then it must have functionality Add to home screen. It contains in your manifest file start_url, which should be cached by the working service and should return a 200 response offline.

Assume that someone is browsing your application offline and has not added the web application to the main screen, then he will ask the user if he / she wants to add to the main screen or not if you cached the manifest file.

+3
source

It is called each time the page is loaded (provided that it is not a SPA). In any case, it is also static, it can also cache it, in my opinion, it saves the user from calling the server for this file.

+1
source

Source: https://habr.com/ru/post/1682865/


All Articles