My Problem: I am trying to setup Progressive Web App for my site but my Manifest.json file's installability shows "Page does not work offline"
I tried to find what's causing this but couldn't. Can someone shed some light into this?
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.
json file is the only file that every extension using WebExtension APIs must contain. Using manifest. json , you specify basic metadata about your extension such as the name and version, and can also specify aspects of your extension's functionality (such as background scripts, content scripts, and browser actions).
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).
Editing a manifestOpen the script project in the Apps Script editor. At the left, click Project Settings settings. Select the Show "appsscript. json" manifest file in editor checkbox.
Your service worker might not have event listener for fetch
event.
Which is basic requirement for PWA.
Just add:
self.addEventListener('fetch',() => console.log("fetch"));
to your service worker or add fetch
listener according to your requirement.
To get more info follow: https://developers.google.com/web/ilt/pwa/lab-caching-files-with-service-worker#3_serve_files_from_the_cache
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