|
|
@@ -0,0 +1,21 @@ |
|
|
|
async function onHeadersReceived({ responseHeaders, url, tabId }) { |
|
|
|
const isAudio = responseHeaders.some(header => |
|
|
|
header.name === 'Content-Type' && header.value.startsWith('audio/') |
|
|
|
); |
|
|
|
|
|
|
|
if (isAudio) { |
|
|
|
browser.tabs.executeScript(tabId, { |
|
|
|
runAt: 'document_end', |
|
|
|
file: '/scripts/contentscript.js', |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
browser.webRequest.onHeadersReceived.addListener( |
|
|
|
onHeadersReceived, |
|
|
|
{ |
|
|
|
urls: ['<all_urls>'], |
|
|
|
types: ['main_frame'], |
|
|
|
}, |
|
|
|
['responseHeaders'], |
|
|
|
); |