We're looking for a person or people to help audit MDN to find places we could speed up. Is this you or someone you know? Check out the RFP: https://mzl.la/2IHcMiE



Use this function to create a webRequest.StreamFilter object for a particular request. You can then use the stream filter to monitor and modify the response. You'd typically call this function from a webRequest event listener.

To use this API you must have the "webRequestBlocking" API permission, as well as the normal permissions needed for the event listener (the "webRequest" permission and the host permission for the host).


var filter = browser.webRequest.filterResponseData(
  requestId       // string


string. ID of the request to filter. You can get this from the details object that is passed into any webRequest event listeners.

Return value

A webRequest.StreamFilter object that you can use to monitor and modify the response.

Browser compatibility

ChromeEdgeFirefoxFirefox for AndroidOpera
Basic support No No5757 No


This example, taken from the http-response example extension, creates a filter in webRequest.onBeforeRequest and uses it to modify the response:

function listener(details) {
  let filter = browser.webRequest.filterResponseData(details.requestId);
  let decoder = new TextDecoder("utf-8");
  let encoder = new TextEncoder();

  filter.ondata = event => {
    let str = decoder.decode(event.data, {stream: true});
    // Just change any instance of Example in the HTTP response
    // to WebExtension Example.
    str = str.replace(/Example/g, 'WebExtension Example');

  return {};

  {urls: ["https://example.com/*"], types: ["main_frame"]},

Example extensions

Document Tags and Contributors

 Contributors to this page: wbamberg
 Last updated by: wbamberg,