service-worker

@angular/service-worker not working when offline

╄→尐↘猪︶ㄣ 提交于 2019-12-18 06:48:36
问题 I never got the service worker from Angular Mobile Team to work properly and at this point I guess I forgot to enable something, because it never worked since the initial release. Even if it installs and run on Google Chrome (smartphone & desktop) when I go offline it doesn't work anymore, also it randomly crashes after updates. There is no documentation on how to set it up. So here is how I did it: ng new test-service-worker npm install @angular/service-worker in .angular-cli.json , I add

Background Geolocation ServiceWorker - onMessage Event order when Web App regains focus [closed]

女生的网名这么多〃 提交于 2019-12-18 04:34:05
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year . For complete details, and a more lengthy description, please refer to this W3C Service worker issue. This is my HTML5 Web App scenario: - My Web App has been backgrounded and stuck in my pocket while I go for a ride As I clock up the KMs my Service Worker(s) is regularly receiving

Implementing push notification using chrome in Django

旧巷老猫 提交于 2019-12-18 04:27:08
问题 I have learned to implement push notifications for a Web Application using chrome https://developers.google.com/web/updates/2015/03/push-notifications-on-the-open-web?hl=en and successfully ran the sample code mentioned in the blog. Unfortunately, I couldn't replicate the success with Django. It never goes into the ready method of the service worker,( navigator.serviceWorker.ready.then ) ie, the service worker is never ready. As per http://www.html5rocks.com/en/tutorials/service-worker

How to use Service Workers in Google Chrome extensions to modify an HTTP response body?

坚强是说给别人听的谎言 提交于 2019-12-18 03:44:14
问题 Now that Google Chrome extensions can register Service Workers, how can I use them in order to modify HTTP responses from all hosts, e.g. by replacing all occurrences of cat with dog ? Below is a sample code from Craig Russell, but how to use it inside Chrome extensions and bind it to all hosts? self.addEventListener('fetch', function(event) { event.respondWith( fetch(event.request).then(function(response) { var init = { status: response.status, statusText: response.statusText, headers: {'X

Only in Chrome (Service Worker): '… a redirected response was used for a request whose redirect mode is not “follow” '

耗尽温柔 提交于 2019-12-17 19:36:39
问题 When I refresh (or go offline) in Chrome then I get "This site can't be reached" and the following logged to console: The FetchEvent for "http://localhost:8111/survey/174/deployment/193/answer/offline/attendee/240/" resulted in a network error response: a redirected response was used for a request whose redirect mode is not "follow". . When I refresh in Firefox everything works fine. Could someone explain why this is happening? Here is my simplified SW. importScripts("/static/js/libs/idb.js")

Setting service worker to exclude certain urls only

我只是一个虾纸丫 提交于 2019-12-17 18:38:24
问题 I built an app using create react which by default includes a service worker. I want the app to be run anytime someone enters the given url except when they go to /blog/, which is serving a set of static content. I use react router in the app to catch different urls. I have nginx setup to serve /blog/ and it works fine if someone visits /blog/ without visiting the react app first. However because the service worker has a scope of ./, anytime someone visits any url other than /blog/, the app

how to register a service worker from different sub domain

假如想象 提交于 2019-12-17 12:41:09
问题 I have two subdomains: https://abc.xxxx.com and https://xyz.xxxx.com. So my questions: 1). is it possible to register a service worker for https://xyz.xxxx.com from https://abc.xxxx.com ? if yes then how? 2). if http://abc.xxxx.com ( http insecure) then anyway to register a service worker for https://xyz.xxxx.com from http://abc.xxxx.com like in iframe or something.... This is a real situation, I am facing for my multiple subdomain. Any help appreciated. Thanks in advance. 回答1: Here are some

How to clear cache of service worker?

强颜欢笑 提交于 2019-12-17 08:48:31
问题 So, I have an HTML page with service worker, the service worker cache the index.html and my JS files. The problem is when I change the JS, the change doesn't show up directly on the client browser. Of course in chrome dev-tools, I can disable cache. But in chrome mobile, how do I do that? I tried to access the site settings and hit the CLEAR % RESET button. But it still loads the old page/load from cache. I tried to use other browser or chrome incognito and it loads the new page. Then, I try

How to clear cache of service worker?

穿精又带淫゛_ 提交于 2019-12-17 08:48:06
问题 So, I have an HTML page with service worker, the service worker cache the index.html and my JS files. The problem is when I change the JS, the change doesn't show up directly on the client browser. Of course in chrome dev-tools, I can disable cache. But in chrome mobile, how do I do that? I tried to access the site settings and hit the CLEAR % RESET button. But it still loads the old page/load from cache. I tried to use other browser or chrome incognito and it loads the new page. Then, I try

Firebase: change the location of the service worker

假装没事ソ 提交于 2019-12-17 07:26:39
问题 I am trying to use Firebase messaging (web). Firebase by default searches for the file "firebase-messaging-sw.js" which holds the service worker. The service worker script is expected to be on the absolute path of the application! For example : http://localhost/firebase-messaging-sw.js How to change this default location?! Searching the official docs I found this method: useServiceWorker which accepts a service worker registeration, but trying to use it I get an error that the method doesn't