service-worker

(unknown): #2514: An unknown error occurred when fetching the script. [Service Workers]

假装没事ソ 提交于 2019-12-22 18:43:43
问题 Here's what's on console: (unknown): #2514: An unknown error occurred when fetching the script. [Service Workers] I am get the above error on my dev console when the service-worker has taken over or skipped waiting and I reload the page with the network turned off. The thing is I get plenty of fetch errors on the console because obviously none of the requests are passing through but there is just one error on SW dev console (Click image): What is it about? The error message itself isn't

Service worker file not found in offline mode

末鹿安然 提交于 2019-12-22 18:37:35
问题 My web app is like this: I have an Apache server running on port 80, with virtual hosts for my domain and different subdomains, including port 443 for SSL. I have a nodejs application running on port 5000. All traffic to my main domain is redirected using proxypass from apache to nodejs. NodeJs then loads Service Workers. Problem: ON first load of application in online mode it works properly.Shows Service worker registered over the complete domain message as expected. Even for some css,js and

How to deploy updates to service workers running on customers' sites?

感情迁移 提交于 2019-12-22 10:55:45
问题 Suppose I provide a push notification service used by different websites. This service requires a service worker to be installed on my customers' sites. I want the architecture to have a few properties: Completely static resources. The process of installing the service worker files and configuring the JS snippet, etc. only needs to be done once. The ability to update the service worker at any time. I want to be able to update the service worker at any time to fix bugs, deploy improvements,

Sending push Notifications from Java Web Application

∥☆過路亽.° 提交于 2019-12-22 10:27:35
问题 I have a Java web application which needs to send manual and automatic notifications to the user. This notification should go to the user's browser as well as the mobile devices (both iOS & Android). I found out there is no way to send notifications to mobile devices directly if there is no native application running on the mobile device. So my only option seems to be web push notifications. I went through a few articles and I found it very confusing. I don't know where to start. Can I send

Service worker not run in offline mode using nodejs server

送分小仙女□ 提交于 2019-12-22 08:55:54
问题 i've been create new project PWA. when i develop not using node js for (socket.io running) just running in offline like i expected and needed. but when integration with nodejs server. when go online the app running well not get any problem. but when i change to offline mode my service work not run but show offline browser. this my code node js server: var express = require('express'); var app = express(); var server = require('http').Server(app); var io = require('socket.io')(server); var

Strategy for Push notifications on Safari

ぃ、小莉子 提交于 2019-12-22 04:46:08
问题 I am working on implementing a PWA which needs to send push notifications, we are looking at a solution for sending push notifications to browsers running on ios(We are using Firebase(FCM) for everything else.) What would be a good strategy to make push notifications on all platforms including ios? We are looking at sniffing the user-agent and use FCM for non-ios users, switch to websockets for ios users. We aren't sure how viable this approach is gonna be. Any suggestions on this approach or

I need to access localstorage or cookie from within the serviceworker

余生长醉 提交于 2019-12-22 03:42:32
问题 I wish to make a fetch call after the push event for fetching the notif data through an internal api with user specific params which are stored in the localstorage or cookie such as usertype or country id .. how do i do this ? 回答1: You cannot use Local Storage in service workers. It was decided that service workers should not have access to any synchronous APIs. You can use IndexedDB instead, or communicate with the controlled page using postMessage() . By default, cookies are not included

How does global error handling work in service workers?

自作多情 提交于 2019-12-22 03:19:31
问题 I found https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/onerror which says: The onerror property of the ServiceWorkerContainer interface is an event handler fired whenever an error event occurs in the associated service workers. However I'm not able to get this working in Chrome (v51). In the scope of the main application, I ran the following code from the console: navigator.serviceWorker.onerror = function(e) { console.log('some identifiable string' + e); }; Then

Angular 5 Service Worker not working

╄→гoц情女王★ 提交于 2019-12-22 03:09:28
问题 I try to add service worker to my project after updating to angular 5 and have some problems. I add imports to app.module.ts: import {ServiceWorkerModule} from '@angular/service-worker'; import {environment} from '../environments/environment'; ... environment.production ? ServiceWorkerModule.register('/ngsw-worker.js') : [], execute $ ng set apps.0.serviceWorker=true to allow service workers in project generate config: { "index": "/index.html", "assetGroups": [ { "name": "app", "installMode":

Get page URL parameters from a service worker

假如想象 提交于 2019-12-22 00:26:38
问题 How do I get page URL with parameters from a service worker? I have tried self.registration.scope but that doesn't include the parameters. 回答1: I'm not clear as to whether you're asking about getting the service worker script's URL, or the URLs of all of the client pages that are open under the service worker's scope. So... here's how to do both: // Get a URL object for the service worker script's location. const swScriptUrl = new URL(self.location); // Get URL objects for each client's