webRequest.StreamFilter.onstop

An event handler that will be called when the stream has no more data to deliver. In the event handler you can still call filter functions such as write(), disconnect(), or close().

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxOperaFirefox for Android
Basic supportChrome No support NoEdge No support NoFirefox Full support 57Opera No support NoFirefox Android Full support 57

Legend

Full support  
Full support
No support  
No support

Examples

This example will append "extra stuff" to the response:

function listener(details) {
  let filter = browser.webRequest.filterResponseData(details.requestId);
  let encoder = new TextEncoder();

  filter.ondata = event => {
    // pass through all the response data
    filter.write(event.data);
  }

  filter.onstop = event => {
    filter.write(encoder.encode("extra stuff"));
    filter.disconnect();
  }
}

browser.webRequest.onBeforeRequest.addListener(
  listener,
  {urls: ["https://example.com/*"], types: ["main_frame"]},
  ["blocking"]
);

Document Tags and Contributors

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