简体   繁体   English

在 WebView 中缓存渐进式 Web 应用程序

[英]Cache a Progressive Web App inside a WebView

I've got a Progressive web app and packaged inside an android WebView.我有一个渐进式 Web 应用程序并打包在一个 android WebView 中。 I'd like it to work offline.我希望它离线工作。 How do I access the cache/service worker and make it happen?如何访问缓存/服务工作者并使其发生?

This is simple - use the ServiceWorkerController instance.这很简单 - 使用 ServiceWorkerController 实例。 Although it only works on Android N and up so make sure to tell your users to install your site as a PWA for these users.尽管它仅适用于 Android N 及更高版本,因此请确保告诉您的用户将您的站点安装为这些用户的 PWA。

https://developer.android.com/reference/android/webkit/ServiceWorkerController https://developer.android.com/reference/android/webkit/ServiceWorkerController

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM