Questions tagged [service-worker]

A service worker is JavaScript code that, once registered with an associated origin and scope, will respond to browser-initiated events, even when the pages it controls are no longer open. By handling `fetch` events, service workers can provide custom network behavior, like offline support (via the Cache API). By handling `push` events, service workers can be "woken up" and display notifications.

service-worker
Filter by
Sorted by
Tagged with
0 votes
1 answer
303 views

Quasar pwa service-worker

I'm trying to configure a service worker, but errors are popping up. I use quasar dev - pwa I use this configuration pwa: { workboxMode: 'injectManifest', // or 'injectManifest' //generateSW ...
Aslero's user avatar
  • 1
0 votes
1 answer
118 views

The service_worker script failed to load. error in Safari extension, converted from chrome extension

I have converted a web extension originally made for chrome to safari, using the tool documented at https://developer.apple.com/documentation/safariservices/safari_web_extensions/...
Kristian Martinez's user avatar
0 votes
0 answers
49 views

Why is index.html not cached offline in Angular PWA?

When using the Angular PWA demo, I noticed the PWA does not start when the browser is offline. In that case, when opening the URL in Chrome, it shows an offline error. Looking in Chrome DevTools, it ...
Wouter van Koppen's user avatar
7 votes
0 answers
191 views

PWA notification how to redirect to installed app if it exists

This seems fairly basic however I can't find an answer on here. The MDN official docs show that getting a notification to navigate back to the app should look like this: self.addEventListener("...
George's user avatar
  • 3,831
3 votes
0 answers
98 views

navigator.serviceWorker.controller not available after web worker registration but available after refresh

navigator.serviceWorker.controller is null after I register my webworker: registration = await navigator.serviceWorker.register('/service-worker.js') console.log(navigator.serviceWorker.controller) &...
George's user avatar
  • 3,831
0 votes
0 answers
81 views

Capture messages from protected websocket with puppeteer

I simply cannot just capture the websocket messages with puppeteer when the websocket is marked with a gear icon in the developer tools. The chrome or the puppeteer dev tools can show the messages on ...
4A81KA's user avatar
  • 1
0 votes
0 answers
11 views

environment variables in google extension [duplicate]

I am trying to use environment variables in google extension. Can someone explain how to use it? I tried the standard way, but process keyword is not available in google extension.it just gave me this ...
Headson's user avatar
0 votes
0 answers
15 views

How can I prevent my PWA reloading on a Share Request

How can I prevent my PWA from restarting when it receives the POST request which comes from a user doing a Share in another app and selecting my PWA as the "share_target". I have everything ...
nevf's user avatar
  • 4,716
0 votes
0 answers
11 views

How can "Save Link As" be made to use service worker?

My web page has some hrefs to documents where the server side checks to make sure the user has included an Authorization header. This header is added to the request by a service worker, and it works ...
Matt Miller's user avatar
0 votes
0 answers
17 views

pre cache in service worker

Is is correct to have this kind of path in precaching? Ive tried to change into this but still not working const PRECACHE_ASSETS = [ `/Content/js/application/web.home.index.js`, `/Areas/Web/...
Erika Mae Baldove's user avatar
0 votes
0 answers
567 views

Maintaining Server-Sent Events (Azure/fetch-event-source) during Mobile Web User Inactivity

I'm working with Server-Sent Events (SSE) using the Azure fetch-event-source library for my react web app that has a retry interval of 30 seconds. Everything works great when the user is on the mobile ...
JasonChee's user avatar
0 votes
0 answers
60 views

Solved! How to use cache.put to add a jpg to the cache?

This question concerns the javascript cache api. I have no problem using cache.add to add jpgs to the cache. But so far I have not figured out how to use fetch and cache.put to do the same thing. I ...
Gmap4 guy's user avatar
  • 321
1 vote
0 answers
123 views

In chome extension mv3, how do a cross origin fetch without downloading linked documents?

I am writing a chrome extension that does a cross origin fetch Here is my code. To run it load it as an unpacked chrome extension. https://github.com/yigalirani/cross_origin_fetch manifest.json { &...
yigal's user avatar
  • 4,273
0 votes
0 answers
89 views

Is it possible for a Chrome extension to communicate directly with a service worker?

I'd like to show some metrics that are captured in the service worker code in my chrome extension. I'm wondering if it is possible for a chrome extension to communicate directly with a service worker ...
jimousse's user avatar
0 votes
0 answers
77 views

Using localForage inside service workers in Next.js

I'm trying to to use localForage inside the service worker to store private access tokens. I don't want to keep the entire localForage file inside my webserver but rather use it from the installed npm ...
Jimi H's user avatar
  • 21
0 votes
0 answers
8 views

Service Worker - Ignore parameter when caching

I want /search?q=query111 and /search?q=query222, /search?q=query333 to use the same name: "search". I can't find any way to do it works. registerRoute( ({ request }) => { var url = ...
meotimdihia's user avatar
  • 4,241
0 votes
0 answers
143 views

How can I receive push notifications after converting pwa to apk?

I have a web project. Manifest settings have been completed, and service worker settings have also been completed. So, the push comes normally on the web. However, I wanted to release it on the Play ...
sseeefa's user avatar
0 votes
0 answers
46 views

How To Get The Current Screen Size When I Click Right Menu In Chrome extension?

I have a Chrome extension, and when a custom context menu is clicked on a webpage, I want to retrieve the screen dimensions within a service worker. How can I achieve this without injecting scripts ...
jack chen's user avatar
-2 votes
1 answer
66 views

problem to cache json file in react pwa service worker(create with cra)

i create pwa app using cra template. my problem is service worker didnt cache my locales folder(contain json file for translation) after running app and in offline mode everything works well except 2 ...
Hanie's user avatar
  • 1
0 votes
0 answers
65 views

Screenshotting the current tab from a crhome extension

I'm currently working on a project and they require a user to able to click on a button on the extension and take a screenshot of the current tab. But the thing is it keeps giving me this error ...
Ankit Sharma's user avatar
0 votes
0 answers
113 views

PWA Custom Install App Button not being displayed even though the install button is present next to the search bar

The install button is visible next to Google Chrome's search bar. Service workers are properly registered and the manifest.json file has all the required properties defined. This is confirmed by the ...
Prograndma's user avatar
0 votes
0 answers
66 views

Adding a service worker to an extension removes the devtools page

I'm trying to create a Chrome extension that adds a DevTools panel and a service worker. In theory, that should be working with the following minimal manifest: { "manifest_version": 3, &...
Moritz Friedrich's user avatar
0 votes
1 answer
156 views

Firebase Cloud Messaging calling wrong service worker after update

I am successfully able to register tokens for FCM to subscribe to a topic and receive messages using the following code to register the service worker, and get the token is as follows after which it ...
Richard's user avatar
  • 71
0 votes
1 answer
284 views

Running an offline service worker and OneSignal in a PWA

I've got a PWA and I'm trying to run OneSignal (for web push notification subscriptions) and an offline service worker alongside each other. They both work on their own. I've tried a few iterations ...
Richard McKechnie's user avatar
1 vote
0 answers
283 views

Can't get around "Failed to register a ServiceWorker" SSL cert error

This is my first attempt to use push notifications, and also my first time trying to create a service worker to receive those notifications. My self-signed certificate is working for all three of ...
kshetline's user avatar
  • 13.2k
0 votes
0 answers
40 views

Service Worker not working in Angular after page reload

I've implemented a Service Worker in my Angular application to cache APIs for offline use. Everything works perfectly on my local machine. However, when I deploy my app on the server, I encounter a ...
Atif's user avatar
  • 1
0 votes
0 answers
9 views

Angular: store and display webpush messages

By default the Angular ServiceWorker displayes received PushNotifications as system notifications. I guess it could be possible to store them in localStorage too, so I can display them in my ...
tris's user avatar
  • 973
1 vote
1 answer
67 views

Angular Serviceworker doesn't cache index.html

My app doesn't work when offline, because the angular serviceworker doesn't cache my index.html (it does cache my js, css, manifest and ico files). This only happens as long as my outputPath is within ...
JonasK's user avatar
  • 199
0 votes
0 answers
72 views

How to manage race condition in a service worker

I'm passing data using postMessage() from my main app.tsx to my service worker. Here's the relevant code in app.tsx which sends the buildId to the service worker upon registration: React.useEffect(()...
igdaloff's user avatar
0 votes
0 answers
109 views

Push notification not displayed using web-push and service workers

I have converted my MERN application to a PWA using the service worker files that are pre-generated with create-react-app. It seems to be working ok as I can see the service worker is activated in the ...
sgt_pepper85's user avatar
0 votes
0 answers
90 views

Service worker not working in when converted website to apk with Capacitor

I have a Ionic React Capacitor project in which I am using a service worker to upload a file to a server. The service worker gets registered and works as expected on web, but when I convert it to ...
Tejas Vaij's user avatar
0 votes
0 answers
85 views

Vite Web App Works in Incognito Mode but Not in Regular Browsing Mode

I just initialized a vite app, vite + React + Typescript. Here are the steps I followed Eh@little: yarn create vite ✔ Project name: … My-app-typescript ✔ Package name: … My-app-typescript ✔ Select a ...
Ethical hacker's user avatar
0 votes
2 answers
97 views

Not able to upload file to Django server from Service Worker in React js

This is the code in my background-worker.js file which is supposed to be responsible for uploading the blob const addExerciseDataToDatabase = async (blob, exercise, patient, authToken) => { ...
Tejas Vaij's user avatar
0 votes
0 answers
95 views

`[Worker Messenger] [Page -> SW] Could not get ServiceWorkerRegistration to postMessage

`[Worker Messenger] [Page -> SW] Could not get ServiceWorkerRegistration to postMessage! I am getting this error in Chrome, and the same code is working fine for edge It's not been working last few ...
Mohd Aqib's user avatar
0 votes
1 answer
93 views

getting "Property 'data' does not exist on type 'Event'" on a PushEvent

I'm trying to write to a service worker to receive push notifications. To display the notification the way I want, I need to listen to the event when the notification arrives on the device and get the ...
Ian Polo's user avatar
0 votes
0 answers
78 views

Flutter web push notification from fcm is not showing up?

I am trying to send the push notification from the server usning fcm api. I have added all the service worker and code to request permision in flutter. Referred many documents and videos not able to ...
Jagan Badiyar's user avatar
1 vote
0 answers
52 views

Can a Service Worker update itself offline?

Let's say that I have a service worker that, among other things, helps make a page or application available offline. Now, the device which runs this application will be offline for a very long time. ...
JamesTheAwesomeDude's user avatar
1 vote
0 answers
29 views

Unable to create an SSL/TLS secure channel push notification to Firefox, Edge and Safari

I have a problem when send a push notification to Firefox, Edge and Safari (this works fine at chrome and brave). The error returns the value: “Unable to create an SSL/TLS secure channel” I think the ...
Mary's user avatar
  • 11
0 votes
0 answers
71 views

how to register firebase-messaging-sw.js in vue app with env variable?

let firebaseConfig = { apiKey: "DTfsawaSyDwR-WuG-fdsaewyr849243", authDomain: "notification-dev.firebaseapp.com", projectId: "notification-dev", storageBucket: "...
Himanshu Bohra's user avatar
0 votes
0 answers
33 views

Extension Not Triggering Before 302 Redirect

I am working on a Chrome extension which takes URL parameters as input on an initial page load and then uses them later for additional processing. The problem I'm facing is that the initial URL which ...
Jimmy's user avatar
  • 13
0 votes
0 answers
55 views

How to move variable out of local scope in service-worker

I am sending data with Broadcast Channel API from source code to service-worker: firebase-messaging-sw.js. Then I retrieve it in service-worker with the following function: const mainChannel = new ...
Nika's user avatar
  • 1
0 votes
0 answers
27 views

How can I use a service worker to cache the homepage?

I'm trying to add a service worker to https://aqua.hyperstage.co.uk/ . The images and CSS files are loading when I turn the internet off (e.g https://aqua.hyperstage.co.uk/views/standard/images/...
nick rimmer's user avatar
1 vote
0 answers
103 views

Firebase cloud messaging (web) - Service worker stops and notifications are not delivered

In my web app (react/typescript/vite), up until last week, everything was working fine. Since today, in Firefox, only some notifications that i send to the specific app token are received, about 1 in ...
jeremodd's user avatar
1 vote
1 answer
134 views

Etiting Angular service worker for sharing files to PWA via share_target API

The App I'm building a PWA as a frontend for OpenAI's Whisper, using this API. The goal is to be able to share WhatsApp voice messages directly to the PWA to transcribe them. I am using Angular 16.2.2 ...
Paul R.'s user avatar
  • 11
1 vote
0 answers
88 views

url_strategy stops caching using Workbox Service Worker

I am developing a PWA using Flutter. To cache assets, I am using Workbox. When I use the url_strategy package, it cleans the hash (#) from the urls. e.g. ( http://localhost:400/homepage ). But the ...
vkjinx's user avatar
  • 11
0 votes
0 answers
127 views

Upgrading an indexeddb which is shared by a PWA and its service worker

I have a PWA which uses indexeddb. (Actually the promise-aware "idb" layer on indexeddb). The indexeddb component is for use offline, so that idb's OpenDB command can happen offline. The ...
Steve Bradshaw's user avatar
1 vote
0 answers
20 views

Call Django service worker method for another device

I want to create a function needsToBeCalled(a, b) in serviceworker.js for Django that can be called from another device. What I need is when Django admin clicks a button, a function should be called ...
miaa26's user avatar
  • 66
1 vote
1 answer
452 views

How can I make a Cloudflare worker stream an OpenAI response back to the front-end?

I am trying to make a Cloudflare worker return chunks of data to the front-end instead of waiting for the full OpenAI result before responding. Currently, it does not seem to return any data before ...
allegutta's user avatar
  • 5,646
1 vote
1 answer
553 views

Service-worker not working on Mozilla Firefox browser

I'm currently facing a problem setting up a service worker for my vue3 application run by node. I've managed to reach a situation where the service worker is running and perfectly working on every ...
msalvalaggio's user avatar
0 votes
0 answers
31 views

Offline page in service worker does not work

I am creating an offline version of my website. I have a service worker file that contains all the logic. When there is an internet connection, the files are stored in the cache. However, when there ...
Pavel's user avatar
  • 1

1 2
3
4 5
96