progressive-web-apps

How to use workbox-webpack-plugin together with Nuxt PWA

假如想象 提交于 2020-02-25 04:09:07
问题 I'm currently on Nuxt with PWA Plugin, including workbox module. However if I'm not mistaken this plugin doesn't allow to add the assets generated by webpack to precaching. Is it possible to use workbox-webpack-plugin for only generating the precaching part of the sw.js file? If so, how would it be done? There is some documentation on https://developers.google.com/web/tools/workbox/modules/workbox-webpack-plugin, however I'm not sure how to apply this to the Nuxt PWA context. 回答1: Turns out

How to detect that the application is being visited through a homescreen bookmark (embedded)?

杀马特。学长 韩版系。学妹 提交于 2020-02-05 04:01:09
问题 The bounty expires in 6 days . Answers to this question are eligible for a +50 reputation bounty. Dimitri Kopriwa wants to draw more attention to this question: “We are trying to detect in javascript on an iPhone 6 if it's an embedded application (PWA) with window.matchMedia('(display-mode: standalone)').matches , that doesn't return true on iOS, only on android with chrome. How can I detect it?” I am writing a react native application with expo SDK36. When a user visit the website, the

Recommended precache payload size?

佐手、 提交于 2020-01-31 03:59:10
问题 (Publicly asking/answering on behalf of someone.) I'm using Workbox to generate a service worker that precaches resources for my progressive web app. Am I wrong to be reluctant to precache ~20mb of minified JavaScript? It's huge, obviously. 20mb seems way too much. My plan was to just precache the essential stuff, and use runtime caching for the rest. In other words, what are some general heuristics for determining what should and shouldn't be included in the precache payload? 回答1: There's a

Bluetooth connectivity using PWA

耗尽温柔 提交于 2020-01-25 06:50:13
问题 According to PWA Web Bluetooth documentation, it supports "either a BR/EDR or LE connection". I am trying to test using the following code at the console of the Chrome devtools: navigator.bluetooth.requestDevice({ acceptAllDevices: true, }) .then(device => { // Human-readable name of the device. console.log(device.name); console.log(device.id); // Attempts to connect to remote GATT Server. return device.gatt.connect(); }) .then(server => { /* ... */ }) .catch(error => { console.error(error);

Can i use service worker caching function in firebase-messaging-sw.js?

核能气质少年 提交于 2020-01-25 06:49:12
问题 So I want to cache my web app assets in a service worker, but I already have firebase messaging SW, can I put my code there or create a new service worker? 回答1: This is what worked for me: - create two service workers: sw.js (for caching and fetch handler) and the firebase-messaging-sw.js as mentioned, sw.js will handle your caching. DO NOT create a "push" or "notificationclick" handler in sw.js create your "push" and "notificationclick" handlers in firebase-messaging-sw.js. I do NOT call any

Aren't PWAs user unfriendly if the service worker is not immediately active?

人走茶凉 提交于 2020-01-25 06:40:15
问题 I posted another question as a brute-force solution to this one (Angular: fully install service worker before anything else) but I thought I'd make a separate one to discuss the use case for when a service worker is used as intended. According to the service worker life cycle (https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle), the SW is installed but it's only active once you then reload the page (you can claim() the page but that's only for calls that happen

If I add a PWA to the homescreen, can I take the current data from the local storage?

↘锁芯ラ 提交于 2020-01-24 17:51:29
问题 In my PWA (a calendar), the user can select a date and save it. This works fine with local storage. But if the user now adds the PWA to his or her Homescreen ("add to homescreen"), this data will not be taken over and must be re-entered. Is there a way to access this data? 来源: https://stackoverflow.com/questions/57458269/if-i-add-a-pwa-to-the-homescreen-can-i-take-the-current-data-from-the-local-sto

Service worker is not supported in chrome (69.0.3497.81)

感情迁移 提交于 2020-01-23 07:57:39
问题 I am start working with PWA (Progressive web app). When I try to check service worker is supported or not in chrome browser.It always return false. Below code I used for the checking. Note: I am using chrome Version 69.0.3497.81 (Official Build) (64-bit). app.js if ('serviceWorker' in navigator) { navigator.serviceWorker.register('/sw.js').then(function() { console.log('service worker registered'); }); } Need help to register service worker in chrome. 回答1: This problem is cause due to I am

is it possible to modify service worker cache response headers?

左心房为你撑大大i 提交于 2020-01-22 14:04:25
问题 I am trying to mark resources that are being stored in the service worker cache. I thought it would be possible to add a custom header to the resource that could indicate this, however, it appears that header modifications are removed once a resource is stored in the service worker cache. Is this the case? I don't see anything in the cache spec about modifying response headers. Here is an example of what I have tried: // I successfully cache a resource (confirmed in Dev Tools) caches.open(

is it possible to modify service worker cache response headers?

房东的猫 提交于 2020-01-22 14:04:06
问题 I am trying to mark resources that are being stored in the service worker cache. I thought it would be possible to add a custom header to the resource that could indicate this, however, it appears that header modifications are removed once a resource is stored in the service worker cache. Is this the case? I don't see anything in the cache spec about modifying response headers. Here is an example of what I have tried: // I successfully cache a resource (confirmed in Dev Tools) caches.open(