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

How will the webviewer know what to display? I presume you were doing the same previously?

Yes, i do the same previously

The following code helped to get rid of the white screen:


But I always get a message that there is no Internet and the site does not work offline

Here is the webviewer setting just in case
image

Please help

My guess is, webviewer cannot run the PHP?

Why do you think I use php? I really use it, but I think that it does not affect anything. Because I use JavaScript to cache the page for it to work properly offline. I really need to finish this project, maybe you can recommend me something else that I can use to turn the site into an Android application quickly and without special knowledge of code.

Thanks again for helping! :heart:

I have now been able to do some quick research on the subject of caching with the android webview. It is not setup by default in the AI2 webviewer, nor enabled with webviewextra - a few more lines of code needed to do this. This would probably make your service worker redundant! If I get some time in the next couple of days, I will update a version for you to test.

There may still be an issue of how index.php is run....we will have to see.

Note this feature is already available if you use the CustomWebView extension

How can I use CustomWebView to achieve my goals? I am ready to install any extension that solves my problem.

You now know how to install and use an extension. Read the topic linked to, just about everything your need to know is there.

1 Like

Sorry, but I could not find an answer to my question in this topic. Could you explain what exactly I need to do to make my site work offline?

Why it has to be offline?

Did you view the CustomWebview topic? Did you install the CustomWebview extension, set it up correctly, as per the guidance in the topic, did you enable cache mode? Did you then test your app? Once you have done this, come back with questions if things are not working as expected.

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