in the implementation of WebRequests API in chrome, you can modify a page’s source before the dom tree is even being built using this function:
let filter = browser.webRequest.filterResponseData(details.requestId);
and then using filter.ondata = event => { […]
this function (browser.webRequest.filterResponseData) is completely missing in FF.
it’s quite essential for anything that rewrites the response, like some kinds of adblockers, fingerprinting protection etc.
Hi there,
as fair as i could find out, they don’t want to implement this functionaltiy (modifying the page source befiore it get’s loaded) due to security reasons.
I mean webRequest.filterResponseData. The only thing I could find about this was a proposal to implement it in Firefox. I couldn’t find any reference mentioning Chrome at all.
all right, when looking closer, i also came to the conclusion that it was a proposal. so the only possibility for replacing the actual html code, at least partitially, will stay injecting a script in the content script.
about mentioning chrome: chrome was the reference for the devlopment of webextensions in firefox. so i simply found it natural to see chrome as the primary instance.
Yeah. You could probably also hack something with nativeMessaging and a proxy on localhost …
chrome was the reference for the devlopment of webextensions in firefox
Was, yes. I think Firefox has mostly moved past the point of implementing chrome stuff. What they are implementing now is primarily “new” WebExtension stuff that Chrome doesn’t know either.