当サイトはユーザー体験を改善するためのメンテナンスを実施中に機能が制限される予定です。記事を読んでもあなたの問題が解決せず質問をしたい場合は、Twitter の @FirefoxSupport、Reddit の /r/firefox で、サポートコミュニティが皆さんを助けようと待機しています。

Mozilla サポートの検索

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

詳しく学ぶ

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

  • 1 件の返信
  • 0 人がこの問題に困っています
  • 最後の返信者: 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.

役に立ちましたか?

質問する

投稿に返信するには あなたのアカウントにログイン する必要があります。まだアカウントをお持ちでなければ、新しい質問を開始 してください。