Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does my Manifest.json shows "Page does not work offline"

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"

enter image description here

I tried to find what's causing this but couldn't. Can someone shed some light into this?

like image 402
Souvik Avatar asked Aug 17 '19 22:08

Souvik


People also ask

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.

What does manifest JSON mean?

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).

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).

How do I edit a manifest JSON file?

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.


1 Answers

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

like image 71
kumudgupta76 Avatar answered Oct 07 '22 20:10

kumudgupta76