webRequest.StreamFilter.suspend()

Suspends a request. After this is called, no more data will be delivered until the request is resumed with a call to resume().

You can't call this function until after the onstart event has fired.

Syntax

filter.suspend()

Parameters

None.

Return value

None.

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 uses suspend/resume to delay a web request.

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

  filter.onstart = event => {
    filter.suspend();

    setTimeout(() => {
      filter.resume();
      filter.disconnect();
    }, 1000);

  }
}

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

Document Tags and Contributors

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