Támogatás keresése

Kerülje el a támogatási csalásokat. Sosem kérjük arra, hogy hívjon fel egy telefonszámot vagy osszon meg személyes információkat. Jelentse a gyanús tevékenységeket a „Visszaélés bejelentése” lehetőséggel.

További tudnivalók

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

  • 1 válasz
  • 0 embernek van ilyen problémája
  • Utolsó üzenet ettől: 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)); });

Módosította: wootiful,

Összes válasz (1)

more options

Check out these two bugz: 1637325 1921989.

Hasznos?

Kérdezzen

Be kell jelentkeznie fiókjába a válaszadáshoz. Kezdjen új kérdést, ha még nincs fiókja.