לאתר זה תהיה פונקציונליות מוגבלת בזמן שאנו מתחזקים אותו לשיפור החוויה שלך. אם מאמר מסויים לא פותר את הבעיה שלך וברצונך לשאול שאלה, קהילת התמיכה שלנו מחכה לעזור לך ב־Twitter תחת ‎@FirefoxSupport וב־Reddit תחת ‎/r/firefox.

חיפוש בתמיכה

יש להימנע מהונאות תמיכה. לעולם לא נבקש ממך להתקשר או לשלוח הודעת טקסט למספר טלפון או לשתף מידע אישי. נא לדווח על כל פעילות חשודה באמצעות באפשרות ״דיווח על שימוש לרעה״.

מידע נוסף

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

  • 1 תגובה
  • 0 have this problem
  • תגובה אחרונה מאת 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)); });

השתנתה ב־ על־ידי wootiful

כל התגובות (1)

more options

Check out these two bugz: 1637325 1921989.

Helpful?

פרסום שאלה

You must log in to your account to reply to posts. Please start a new question, if you do not have an account yet.