workbox

302 redirects do not work in a service worker built with Google Workbox

被刻印的时光 ゝ 提交于 2020-01-04 05:45:08
问题 For having the "add tome homescreen" alert displayed, I want to integrate a service-worker and an offline capability of the application: When the user is offline, the app should simply display a special offline HTML file. My service-worker looks like this: importScripts('https://storage.googleapis.com/workbox-cdn/releases/3.1.0/workbox-sw.js'); const CACHE_VERSION = 1; workbox.core.setCacheNameDetails({ prefix: 'app', suffix: 'v' + CACHE_VERSION }); workbox.routing.registerRoute( '/offline

Localising a PWA web manifest

陌路散爱 提交于 2020-01-03 05:42:08
问题 Is there a way in which a web manifest can be localised? i.e. having multiple translations of name , description etc... I have thought of a couple of potential solutions but they each have pretty big drawbacks... Potential Solution 1 (preferred but not sure if it will work) Dependant on the locale in the url ( example.com/en/foo ), load the relative manifest. For example: For example.com/en/foo , load example.com/en/manifest.json For example.com/jp/foo , load example.com/jp/manifest.json

What are the downsides to using skipWaiting and clientsClaim with Workbox?

╄→гoц情女王★ 提交于 2019-12-31 10:48:51
问题 By default skipWaiting is set to false in Workbox. Assuming you're only using the Workbox-created service worker for caching, are there any downsides to setting this to true? Without doing so, the next build of your app will ship updated resource urls (from webpack). These urls will be updated in the service worker's precache manifest, but without skipWaiting , the updated service worker will not be activated to take advantage of them, until the user closes their browser and re-opens. These

webview.request access to requests initiated by the service worker

断了今生、忘了曾经 提交于 2019-12-25 01:40:51
问题 In a Chrome App I am able to access requests made by the <webview> and I am able to redirect if needed. The problem is the web app rendered inside the <webview> tag registers a service worker and lots of requests are handled by the service worker. Based on my tests the onBeforeRequest won't be notified. It works if I unregister the service worker, though. webview.request.onBeforeRequest.addListener( this.handleRequest, {urls: [pattern], types: ["image"]}, ["blocking"] ); So, is this a bug? or

Manually replaying requests queued by workbox-background-sync

微笑、不失礼 提交于 2019-12-24 09:08:04
问题 I am working on offline support in my PWA app. I am using workbox for that. This is my current code: const addToFormPlugin = new workbox.backgroundSync.Plugin('addToForm'); workbox.routing.registerRoute( RegExp('MY_PATH'), workbox.strategies.networkOnly({ plugins: [addToFormPlugin] }), 'POST' ); The code seems to works fine on my computer. However, once I run the app on the phone it takes ages to upload requests stored in IndexedDB. I know that it happens on the SYNC but it seems to take at

Workbox is caching only time stamps to indexDb, how to intercept with json data in indexDb?

天大地大妈咪最大 提交于 2019-12-24 00:33:27
问题 Below route defines to store json data as MyCachedData in cache storage, and IndexDb only stores the url and timestamp. workboxSW.router.registerRoute('/MyApi(.*)', workboxSW.strategies.staleWhileRevalidate({ cacheName: 'MyCachedData', cacheExpiration: { maxEntries: 50 }, cacheableResponse: {statuses: [0, 200]} }) ); Is it possible to store the json data in the index db only and how can you define it to intercept (add, update, delete) using Workbox? 回答1: No, Workbox relies on the Cache

How to use Laravel Mix and WorkBox?

空扰寡人 提交于 2019-12-22 09:39:52
问题 I'm trying to build a PWA for my app; and have spent almost 48 hours trying to figure out how to make use of Workbox with Laravel Mix. What's ironical is that Google says Workbox is meant to make things easy! Buh! Okay, so far I've figured out that - I will need to use the InjectManifest Plugin because I want to integrate Push notifications service in my Service Worker I have no clue how to specifiy the paths for swSrc and swDest . What code should go into my webpack.mix.js and whether I

PWA cache for xml based frameworks

ⅰ亾dé卋堺 提交于 2019-12-13 04:33:27
问题 While integrating PWA for Frameworks based on XML & FTL like ApacheOfbiz, Oracle ATG the js, CSS file gets cached but unable to cache text/document files. As the result my pages are not loading in offline Here my service worker code: workboxSW.router.registerRoute(/\.(?:html|document|css|js)$/, workboxSW.strategies.networkFirst({ "cacheName": "CachePages" }), 'GET'); 来源: https://stackoverflow.com/questions/56863293/pwa-cache-for-xml-based-frameworks

workbox-webpack-plugin & Angular. How to listen to broadcastUpdate event in Angular

末鹿安然 提交于 2019-12-12 11:28:41
问题 I'm trying to use service-worker with my Angular Application. It is build using webpack. I use workbox-webpack-plugin. I want to serve my GET API calls form cache and in the background update the data. FOr this, I use the option runtimeCaching with the handler staleWhileRevalidate (more details on GenerateSW plugin here) This is the config I have in webpack.config.js: new GenerateSW({ // importWorkboxFrom: 'local', clientsClaim: true, skipWaiting: true, navigateFallback: '/index.html',

Cannot scrub/scroll through jPlayer audio when mp3 is cached by Workbox

 ̄綄美尐妖づ 提交于 2019-12-11 16:32:42
问题 I have converted a single page HTML5 Cordova app into a PWA. The app uses jPlayer extensively to play mp3 files. I am using a variant of the circular jPlayer here: http://jplayer.org/latest/demo-05/. The circle player has a circular progress bar that can also be used to scrub backwards and forwards through the track. Everything works fine in PWA mode until I cache the mp3 with Workbox (version 4.3.1). Then scrubbing fails. I can grab the scrub bar and move it but when I release it the track