Cerca nel supporto

Attenzione alle mail truffa. Mozilla non chiederà mai di chiamare o mandare messaggi a un numero di telefono o di inviare dati personali. Segnalare qualsiasi attività sospetta utilizzando l'opzione “Segnala abuso”.

Ulteriori informazioni

Does Firefox support service workers for videos loaded from a video element?

  • 1 risposta
  • 0 hanno questo problema
  • Ultima risposta di TyDraniu

more options

I'm trying to use a service worker to add some additional headers to image and video requests but on Firefox the fetch event is only being invoked for the images and not the videos. On Chrome it is called for both.

I cannot find any documentation that says Firefox does not support service workers for video but this appears to be the case. Can anybody point me in the right direction?

sw.js 'use strict';

self.addEventListener("install", (event) => {

 // Force the newly installed service worker to replace any earlier version
 self.skipWaiting();

});

self.addEventListener("activate", (event) => {

 // Activate the service worker immediately in all clients  
 event.waitUntil(self.clients.claim());

});

self.addEventListener('fetch', (event) => {

 console.log(`SW.js: ${event.request.url}`);
 const updatedHeaders = new Headers(event.request.headers);
 //updatedHeaders.set('Accept', '*');
 // Create a new request object with the updated headers
 const updatedRequest = new Request(event.request, {
   headers: updatedHeaders
 });
 event.respondWith(fetch(updatedRequest));

});

I'm trying to use a service worker to add some additional headers to image and video requests but on Firefox the fetch event is only being invoked for the images and not the videos. On Chrome it is called for both. I cannot find any documentation that says Firefox does not support service workers for video but this appears to be the case. Can anybody point me in the right direction? sw.js 'use strict'; self.addEventListener("install", (event) => { // Force the newly installed service worker to replace any earlier version self.skipWaiting(); }); self.addEventListener("activate", (event) => { // Activate the service worker immediately in all clients event.waitUntil(self.clients.claim()); }); self.addEventListener('fetch', (event) => { console.log(`SW.js: ${event.request.url}`); const updatedHeaders = new Headers(event.request.headers); //updatedHeaders.set('Accept', '*'); // Create a new request object with the updated headers const updatedRequest = new Request(event.request, { headers: updatedHeaders }); event.respondWith(fetch(updatedRequest)); });

Modificato da wootiful il

Tutte le risposte (1)

more options

Check out these two bugz: 1637325 1921989.

È stato utile?

Richiedi supporto

Bisogna accedere al proprio account per rispondere nelle discussioni. Se non si possiede ancora un account, inserire una nuova richiesta.