3

I developed a few appllications with google app script and deployed them as Web apps they are all working fine.Then I decided to convert them to PWA's.The reason was to make them installable on smart phone User's Home Screen, being able to use push notifications, cacheing e.t.c. (All the advantages that PWA's offer in short.)

I started learning about PWA's. As a result I came to a conclusion that I need a maifest.json file that browsers dowload , a service-worker.js that again browswers download and run.

Unfortunately, app script development environment does not allow to add files with *.json and *.js extensions.

So, does that mean I can't convert my google app script web apps to PWA's?

Thank you.

Facimus
  • 37
  • 1
  • 7

3 Answers3

3

A theoretical solution would be include the files inline, somehow like this for the manifest (taken from this answer)

<link rel="manifest" href='data:application/manifest+json,{ "name": "theName", "short_name": "shortName", "description": "theDescription"}' />

and for the service workers just including directly the tag; but service workers must be by nature independent from the page (see here).

So we could try to serve them through doGet(e). BUT unfortunately is not possible at current time, since you'd need to foreign fetch the service worker, but Foreign Fetch has been removed from Service Workers see this other reply for more details

marcomow
  • 324
  • 2
  • 12
-1

Correct
Your PWA needs to be able to register a service worker to be installed

Once you have something like that, use the Lighthouse Audit tool to test your PWA
That is available in the Chrome Dev tools or as a Chrome Extension
Under the PWA results you should see
---- "User can be prompted to Install the Web App"

If you want to try a working example with the audit tool, I have one here
https://a2hs.glitch.me/

That is a test PWA
I intercept the Chrome & Edge A2HS prompts
And show a button for the user to install if/when they like

Mathias
  • 4,243
  • 4
  • 25
  • 34
  • Actually, I need some clearer info on how to convert a google app's script WEB app into a PWA. – Facimus Jan 13 '19 at 19:42
  • 1
    Since a google search for "google app script" "PWA" only returns your questions here, I'll guess that nobody has done it. So it may not be possible. (That's a GUESS by me) You would probably be better off starting with a more traditional tool to build a website. At least you would be able to find more people who could help. – Mathias Jan 14 '19 at 20:13
-1

I only just came across this post as I also need to know how to produce a PWA from apps script. I found example of one on YouTube:

https://www.youtube.com/watch?v=TfMzlky_wYE

So it clearly can be done - but I don't know Spanish!

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 23 '22 at 06:27