service-worker

Service worker doesn't return file from cache

ⅰ亾dé卋堺 提交于 2020-01-24 11:29:05
问题 I'm trying to cache a single page webapp with a service worker. It should get all it's files from the cache and update that cache only when a new service worker-version is published. With a precache function i'm writing some files to the cache as follows: function precache() { return caches.open(CACHE).then(function(cache) { return cache.addAll([ 'index.html', 'js/script.js', 'img/bg.png', 'img/logo.svg', ... ]); }); } (I've tried to cache with and without "/" before the paths, and even with

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(

is it possible to modify service worker cache response headers?

久未见 提交于 2020-01-22 14:03:17
问题 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(

Service Worker expiration

心不动则不痛 提交于 2020-01-22 12:12:07
问题 Once the Service Worker is installed, how long does it take for Chrome browser to check for a newer version of it? When does current client-side service worker expire usually? I'm trying to figure out best practice for developing with Service Workers and pushing changes to prod. Currently, once there is a change implemented on how Service Worker behaves, clients are not always picking that up if a previous Service Worker has already been installed. This question is also somewhat relevant:

Service Worker expiration

戏子无情 提交于 2020-01-22 12:11:01
问题 Once the Service Worker is installed, how long does it take for Chrome browser to check for a newer version of it? When does current client-side service worker expire usually? I'm trying to figure out best practice for developing with Service Workers and pushing changes to prod. Currently, once there is a change implemented on how Service Worker behaves, clients are not always picking that up if a previous Service Worker has already been installed. This question is also somewhat relevant:

Service Worker expiration

大城市里の小女人 提交于 2020-01-22 12:10:00
问题 Once the Service Worker is installed, how long does it take for Chrome browser to check for a newer version of it? When does current client-side service worker expire usually? I'm trying to figure out best practice for developing with Service Workers and pushing changes to prod. Currently, once there is a change implemented on how Service Worker behaves, clients are not always picking that up if a previous Service Worker has already been installed. This question is also somewhat relevant:

How to intercept HTTP OPTIONS calls made by the browser

我们两清 提交于 2020-01-21 10:17:04
问题 I have a use case where I'd like to intercept and log HTTP OPTIONS calls. I understand these are being done by the browser as part of CORS I've tried monkeypatching XMLHttpRequest, and also a service-worker where I'd intercept via the "fetch" event. However I am only ever able to capture non OPTIONS calls (GET, PUT, POST) How can I intercept the OPTIONS calls? I clearly see them being done in the network tab 回答1: CORS preflight requests are hard-coded into browsers as a browser security

Offline web application using beforeunload event

谁说胖子不能爱 提交于 2020-01-16 18:16:32
问题 Simply, I'm trying to make simple functionality for my web app when the browser being in the offline. The functionality is a simple message that tells the user about there is no network connectivity instead of the default's browser's page. I have tried the following: window.addEventListener("beforeunload", function() { if (!navigator.onLine){ document.write("There is no network connection."); debugger;return false; } }, false); The above code worked with Chrome, but it does not work with

TypeError: Failed to register a ServiceWorker: A bad HTTP response code (404) was received when fetching the script

早过忘川 提交于 2020-01-14 05:04:28
问题 I'm trying to add a service worker to a website.I'm using Node.js with Express.js,Vue.js and EJS.^ My node server (index.js) looks like : const https = require('https'); const fs = require('fs'); const express = require('express'); const app = express(); const router = express.Router(); const pool = require('./mysqldb.js'); const pathView = __dirname + "/views/"; var bodyParser = require("body-parser"); const listenPort = 8010; // Process application/x-www-form-urlencoded app.use(bodyParser