The JavaScript service worker placed on my website doesn't work in the MIT App Inventor WebViewer

I want my in-app site to work offline

So I read this topic, sorry but I can't figure out how exactly to activate the cache mode and correctly connect the extension. Could you explain in more detail what code I should use? :pray:

Leave everything. Just tell me are you able to load your site in CustomWebView?

How to load my site in CustomWebView?

That's an interesting question.
You can find the answer in last few posts of CustomWebView topic.

Can you share the link please? :pray:

It was in this post above!

I'm sorry, but I don't understand what exactly I should do. In addition, I do not speak English and am forced to use a translator because of this, I may not understand everything. Please, if possible, explain in more detail what I should do specifically :pray:

Try this

cwvdemo.aia (77.1 KB)

2 Likes

Unfortunately it doesn't work :sob:
Here is a link to my site, maybe it will help:
https://alarm-map.sdl.pp.ua/?application=true
Thank you for helping :handshake:

Thanks for the url, will do some more testing....

1 Like

Your site automatically caches itself or we need to click somehere?

automatically, but only if "?aplication=true" present at the end of the link

Seems to "half" work. if you turn off the network whilst viewing the site with the app open, it is still possible to browse the website (I would have expected this). But if you properly close the app and restart it, then it throws an error of being unable to view due to no network. Perhaps @vknow360 can shed some light on this?

I tested with compiled app (cwvdemo) both with and without the cachemode blocks.

1 Like

Looks like not possible.

What do you recommend I use to achieve my goal?

  1. Stay online
  2. Keep your app alive (various methods or extensions available to do this)
  3. Build an app to replicate your site when offline

I mean a decision that does not necessarily apply MIT App Inventor

There are other platforms that can generate an apk from a website, why not look them up and try them?

Most of them add ads to the app (