service-worker

Chromedriver Offline Network Conditions seems to not block Service Worker fetches

风格不统一 提交于 2021-02-08 03:42:30
问题 I have a site with a Service Worker that caches some static resources on install. Some other resources are not cached, like data requests. So if you test the site using offline mode in Chrome, most of the page is properly displayed, but data is not there, and some errors appear in the console because of those failed requests. All right so far. But then I've created a test with Selenium and Chromedriver. I load that site, I visit the home page, Service Worker is properly installed, and then I

Chromedriver Offline Network Conditions seems to not block Service Worker fetches

女生的网名这么多〃 提交于 2021-02-08 03:42:28
问题 I have a site with a Service Worker that caches some static resources on install. Some other resources are not cached, like data requests. So if you test the site using offline mode in Chrome, most of the page is properly displayed, but data is not there, and some errors appear in the console because of those failed requests. All right so far. But then I've created a test with Selenium and Chromedriver. I load that site, I visit the home page, Service Worker is properly installed, and then I

Angular 5 Multiple Service Worker in one domain

浪子不回头ぞ 提交于 2021-02-07 12:38:49
问题 I have two service workers in two application on the same domain (both Angular 5): one inside /frontend/ second inside /backend/ I am using @angular/service-worker package to manage service worker. When i build prod version and deploy my applications something strange happens. When im enter first to http://my.domain/frontend/ i can't go to http://my.domain/backend/ because service worker loading files and redirect me to http://my.domain/frontend/ What is wrong with this setup? i need to

Vue Router History Mode with PWA in Offline Mode

不想你离开。 提交于 2021-02-06 03:53:44
问题 To get history mode working with Vue-Router you need to return the contents of your main page when trying to access a route that doesn't exist. For example when you visit mypwa.com/route1 your server checks if there is a resource at route1 and if there isn't, it returns the contents that is found at mypwa.com/ (but without redirecting you). This is great and works when you're online, but it requires your server to do the actual re-routing. If you have a PWA that's meant to work offline, you

Vue Router History Mode with PWA in Offline Mode

我们两清 提交于 2021-02-06 03:42:36
问题 To get history mode working with Vue-Router you need to return the contents of your main page when trying to access a route that doesn't exist. For example when you visit mypwa.com/route1 your server checks if there is a resource at route1 and if there isn't, it returns the contents that is found at mypwa.com/ (but without redirecting you). This is great and works when you're online, but it requires your server to do the actual re-routing. If you have a PWA that's meant to work offline, you

Sharing fetch handler logic defined across multiple service workers

冷暖自知 提交于 2021-02-04 16:28:26
问题 Following This Discussion, Where there is a comment that speaks of patching a Fetch by overriding self.fetch, self.XMLHttpRequest, and self.caches (for cache.add/addAll)? It would seem these would let you intercept network requests and manipulate responses before the main SW script sees them. I have been looking out for any documentation that speaks of such stuff, and can not seem to find any. In a scenario where I simply need multiple service workers to co exist in a single scope, After

How to load website offline from base url using Service Workers and Cache Api?

你。 提交于 2021-01-29 18:53:58
问题 When you visit this web site https://bugs.stringmanolo.ga/index.html, while navigating around the main.js file is calling a method from ff.js file to cache a good amount of the resources. So next time you land to the web the files are directly taken from your browser cache without make any request. This means if you visited my website before, you can load it again without internet conection. The problem is, this only works if you directly time the index.html file in the addressbar. Lame. Thid

Second update service worker doesn't work

▼魔方 西西 提交于 2021-01-29 17:19:49
问题 I hava a pwa with this sw.js: const info = "versione: 1.0.0 data: 07-01-2020 12:46"; const CACHE = "pwa-offline"; const pages = [ // some files ]; self.addEventListener("install", function (event) { //console.log("Install Event processing"); self.skipWaiting(); event.waitUntil( caches.open(CACHE).then(function (cache) { //console.log("Cached offline page during install"); return cache.addAll(pages); }) ); }); self.addEventListener("activate", (event) => { }); self.addEventListener("fetch",

Can I http poll or use socket.io from a Service Worker on Safari iOS?

痴心易碎 提交于 2021-01-29 15:58:19
问题 I'm building a PWA that on Android uses Push Notifications to receive alerts. Of course, Safari/iOS doesn't support Push Notifications, so I need to implement an equivalent. Can I have my Service Worker poll for data, either using http long timeouts or socket.io? On receiving an alert, the SW will focus/create an app window to then deal with the UX. If there is a list of cans & can'ts or dos * don'ts for service workers, that would be great. 回答1: No, that is not possible. You cannot keep the

Service Worker vs Web Worker

戏子无情 提交于 2021-01-29 10:44:41
问题 I wanna implement push notification for my website: Consider we have a shopping site, whenever a user click on one product, the server should push notification to the owner of the product that user (for example John) wants to buy your shoe. (real-time). I have read some articles about web worker (like socket.io) and service workers, I conclude that service workers are the best choice. Am I true? How can I implement that push notification? 回答1: A Service Worker is a special kind of Web Workers