How to add response headers to data-urls by Chrome.webRequest -
i according chrome.webrequest want change data-urls responseheaders.but can't capture data request in chrome.webrequest.onheadersreceived
.
am wrong ?
chrome.webrequest.onbeforerequest.addlistener( function (details) { const url = details.url if(url == 'http://www.example.com/api/getusers') { return { redirecturl: 'data:application/json; charset=utf-8,' + json.stringify({"a":1, "b": 2}) } } return {cancel: false} }, {urls: ["<all_urls>"]}, ["blocking"] ) chrome.webrequest.onheadersreceived.addlistener( function (details) { console.log(details) // can't capture data-urls return {responseheaders:details.responseheaders}; }, {urls: ["<all_urls>"]}, ["responseheaders","blocking"] )
you can't capture data:
urls webrequest
api, since data:
not supported scheme host permissions.
as such, <all_urls>
permission/filter won't events data:
documentation quote:
the webrequest api exposes requests extension has permission see, given host permissions. moreover, following schemes accessible:
http://
,https://
,ftp://
,file://
,ws://
(since chrome 58),wss://
(since chrome 58), orchrome-extension://
.
i'm pretty sure there's feature request this, can't find it.
Comments
Post a Comment