service-worker

Service Worker w offline.html Backup Page

冷暖自知 提交于 2019-12-11 14:39:14
问题 I can't get the offline.html page to display. I keep getting the The FetchEvent for "https://my-domain.com" resulted in a network error response: a redirected response was used for a request whose redirect mode is not "follow" . Here's the snippet of my service-worker.js which should return the offline.html when the network is unavailable. self.addEventListener('fetch', function(event) { if (event.request.mode === 'navigate' || (event.request.method === 'GET' && event.request.headers.get(

FirebaseError - messaging/failed-serviceworker-registration

烈酒焚心 提交于 2019-12-11 12:46:05
问题 Okey here is the deal, I have asked a couple of firebase related question already in Stackoverflow, and even without any answers I managed to get firebase working, and received a bunch of notifications. I really don't know what I did to make it work, it was a combination of lots of things. (Related issues posted earlier: How to include firebase cloud messaging into ReactJS project using webpack | Firebase FCM with ReactJS and Webpack not working: We are unable to register the default service

FCM data messages doesn't load in firefox

久未见 提交于 2019-12-11 11:38:52
问题 I am working on cloud messaging using Web FCM. When I send a notification with title and body, both firefox and chrome shows notification and works fine. But when I trying to send FCM Data Message, firefox doesn't receive and log Messages. I am using a HTTPS secure url and also this template. This is my javascript function: function sendMSG() { var _ID = $("#user_id").val(); var ServerKey = "SERVER_KEY"; var msg = { "to": _ID, "data": { "Nick": "Mario", "body": "great match!", "Room":

Can't access arrayBuffer on RangeRequest

五迷三道 提交于 2019-12-11 11:29:58
问题 Trying to solve the problem referenced in this article: https://philna.sh/blog/2018/10/23/service-workers-beware-safaris-range-request/ and here: PWA - cached video will not play in Mobile Safari (11.4) The root problem is that we aren't able to show videos on Safari. The article says it has the fix for the issue but seems to cause another problem on Chrome. A difference in our solution is that we aren't using caching. Currently we just want to pass through the request in our service worker.

Access to the Indexed Database API is denied in this context

大兔子大兔子 提交于 2019-12-11 07:36:12
问题 I'm getting an exception when I try to access IndexedDB in Chrome with Service Workers. I'm not using a web server so I execute my html files locally onto browser so my url is something like file:///D:/Dev/web/sample-sw/index.html I don't know why the code works on Firefox but it doesn't on Chrome. This is the exception: Unhandled rejection: OpenFailedError: SecurityError Failed to execute 'open' on 'IDBFactory': access to the Indexed Database API is denied in this context. My index.html is

Register inline service worker in web app

半腔热情 提交于 2019-12-11 07:26:43
问题 I'm toying with adding web push notifications to a web app hosted with apps script. To do so, I need to register a service worker and I ran into an error with a cross-domain request. Raw content is hosted from *.googleusercontent.com while the script URL is script.google.com/* . I was able to successfully create an inline worker using this post on creating inline URLs created from a blob with the script. Now I'm stuck at the point of registering the worker in the browser. The following model

Fetch API inside Service Worker fails only for the home page. When reloading it serves the cached offline page

随声附和 提交于 2019-12-11 06:56:24
问题 I've been fighting with this for a few months now and cannot figure it out. I've been using a service worker for a while now without issue but recently I would load my website's homepage and then do a simple refresh and I would be served the offline page (and if I remove the offline page from the cache it refreshes to connection error screen). This only happens on the home page and must have something to do with the Fetch API (see below). The fetch error is simply "Failed to fetch" and does

Ionic serve / ionic run not reflecting changes

。_饼干妹妹 提交于 2019-12-11 06:33:44
问题 Both ionic serve and ionic run are not reflecting any of my latest changes. ionic serve is showing them from a few hours ago, and ionic run is showing them from about an hour later. Since then, I've discarded all my changes, and created a new branch from the parent--yet it's still showing those same versions from a few hours ago on the first branch. In short, there's code showing up that I don't have in any files in this, or any, branch. And no uncommitted changes. Your system information:

Finding the number of active push notifications from service worker

戏子无情 提交于 2019-12-11 06:31:47
问题 I’ve implemented push notifications using service workers. Is there any way to find out the number of notifications which are currently shown in the window? My intention is to limit the number of notifications shown in the window. I tried the following. But the getNotifications function returning me empty array. self.addEventListener('push', function(event) { if (!(self.Notification && self.Notification.permission === 'granted')) { return; } var data = event.data.json(); var options = { body:

Rewrite URL offline when using a service worker

半世苍凉 提交于 2019-12-11 06:06:58
问题 I am making a web application with offline capabilities using a service worker generated by a Nodejs plugin called sw-precache. Everything works fine and I do have access to the html files or images offline. But then, since you have no server-side language possible, is there a way to rewrite url client-side like an .htaccess file would do? Like showing a "404 Page not found" page when no file matches the url? I know that redirections are possible using Javascript or meta tags, but rewriting