service-worker

Communicate between tabs dom without window ref [duplicate]

为君一笑 提交于 2019-12-20 12:38:57
问题 This question already has answers here : Communication between tabs or windows (9 answers) Closed 3 years ago . I use the following to open new tab (in new process) with some page content, var p = document.getElementById("myElement"); var a = document.createElement('a'); a.setAttribute('href',".../mypage.html"); a.setAttribute('rel',"noreferrer"); a.setAttribute('target',"_blank"); p.appendChild(a); a.click(); http://news.softpedia.com/news/Force-Google-Chrome-to-Open-Links-in-New-Processes

Angular Service Worker - Failed to load resource: the server responded with a status of 504 (Gateway Timeout)

时间秒杀一切 提交于 2019-12-20 09:46:40
问题 I am using the Angular-CLI 1.6.6 and @angular/service-worker 5.2.5 in our Angular 5.2.5 app. Everything works fine on the local lite-server, as well as on the production server, except for one error message popping in our production environment: Failed to load resource: the server responded with a status of 504 (Gateway Timeout) Looking into the ngsw-worker.js script I found the lines (2466 following) where the error message above is generated: async safeFetch(req) { try { return await this

How to refresh the page after a ServiceWorker update?

只谈情不闲聊 提交于 2019-12-20 09:46:15
问题 I've consulted a lot of resources on Service Workers: Updating your ServiceWorker ServiceWorker: Revolution of the Web Platform Jake Archibald's lovely SVGOMG. However, I can't for the life of me figure out how to update the page after a new ServiceWorker has been installed. No matter what I do, my page is stuck on an old version, and only a hard refresh (Cmd-Shift-R) will fix it. No combination of 1) closing the tab, 2) closing Chrome, or 3) location.reload(true) will serve the new content.

How to handle routing in Angular 5+ Service Workers?

一世执手 提交于 2019-12-20 08:13:20
问题 In previous versions of the Angular service worker implementation, one of the config options was "routing" . This can be seen in this unanswered SO question, was referenced in this Angular CLI issue, and the best remaining documentation seems to be the blog post by Stephen Fluin (on the Angular team), as well as the I/O talk from Alex Rickabaugh (from Google). With Angular 5, the ServiceWorkerModule has been well built-out, and most of the configuration can now be handled using the ngsw

How to handle routing in Angular 5+ Service Workers?

谁说我不能喝 提交于 2019-12-20 08:12:23
问题 In previous versions of the Angular service worker implementation, one of the config options was "routing" . This can be seen in this unanswered SO question, was referenced in this Angular CLI issue, and the best remaining documentation seems to be the blog post by Stephen Fluin (on the Angular team), as well as the I/O talk from Alex Rickabaugh (from Google). With Angular 5, the ServiceWorkerModule has been well built-out, and most of the configuration can now be handled using the ngsw

How to alter the headers of a Response?

时间秒杀一切 提交于 2019-12-19 10:35:10
问题 Is it possible to alter the headers of a Response object, as returned by fetch()? Suppose I want to transform a response via resFn : self.addEventListener('fetch', function (event) { event.respondWith(fetch(event.request).then(resFn)); }); What should resFn() look like? One attempt: function resFn(res) { res = res.clone(); res.headers.set("foo", "bar"); return res; } Fails with TypeError: Failed to execute 'set' on 'Headers': Headers are immutable . (A separate question and answer explain how

Can users clear the service worker cache?

早过忘川 提交于 2019-12-19 07:55:14
问题 I've built a Progressive Web App that uses caching, but it's unclear to me whether users can (accidentally or on purpose) clear the service worker cache, which may clear my tracking data. 回答1: When a user clears their browsing data / cookies, this clears all site storage which includes the SW cache, cookies, local storage, indexeddb, and any other local caching system. 回答2: Furthermore, Ctrl-F5 forces a cache refresh, and is intended to abandon all cached content including service worker

“New version available” with service worker and sw-precache

喜你入骨 提交于 2019-12-19 02:03:34
问题 I'm trying to use sw-precache , but I must be doing something wrong! I'm mostly using the demo code available from the github repo and can't seem to get updates to the app to come through. Once it's cached the first time, it never checks for new versions. I was expecting that when I publish a new service worker, the browser would request the new service worker and update the cache accordingly in the background. Then using the registration code in the example, I would be able to prompt the

“New version available” with service worker and sw-precache

孤人 提交于 2019-12-19 02:03:29
问题 I'm trying to use sw-precache , but I must be doing something wrong! I'm mostly using the demo code available from the github repo and can't seem to get updates to the app to come through. Once it's cached the first time, it never checks for new versions. I was expecting that when I publish a new service worker, the browser would request the new service worker and update the cache accordingly in the background. Then using the registration code in the example, I would be able to prompt the

Open installed PWA from external url

空扰寡人 提交于 2019-12-18 18:55:07
问题 Is there any method to open website (PWA) urls in the installed PWA in iOS- Safari? Use case: I'm sending email links to login in my PWA, how can I make this url's open directly with the installed PWA instead of the browser? 回答1: If you are using Chrome in Android or any of the desktop OS, that would be the default behavior. Check on "Android intent filter" in this link. This feature is not supported in iOS yet for PWA apps(created using Safari- the only option for iOS as of June-2018).See