webRequest.RequestFilter

An object describing filters to apply to webRequest events.

Type

Values of this type are objects. They contain the following properties:

urls
array of string. An array of match patterns. The listener will only be called for requests whose targets match any of the given patterns. Only requests made using HTTP or HTTPS will trigger events, other protocols (such as data: and file:) supported by pattern matching do not trigger events.
typesOptional
array of webRequest.ResourceType. A list of resource types (for example, stylesheets, images, scripts). The listener will only be called for requests for resources which are one of the given types.
tabIdOptional
integer. The listener will only be called for requests from the tab identified by this ID.
windowIdOptional
integer. The listener will only be called for requests from the window identified by this ID.
incognito Optional
boolean. If provided, requests that do not match the incognito state (true or false) will be filtered out.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxOperaSafariFirefox for Android
RequestFilterChrome Full support Yes
Notes
Full support Yes
Notes
Notes If a filter contains unrecognized values in its types property, addListener() throws an exception.
Edge Full support 14
Notes
Full support 14
Notes
Notes If a filter contains unrecognized values in its types property, addListener() throws an exception.
Firefox Full support 45
Notes
Full support 45
Notes
Notes From Firefox 78 onwards, if a filter contains unrecognized values in its types property, then these values are ignored and addListener() proceeds.
Notes Before Firefox 78, if a filter contains unrecognized values in its types property, addListener() throws an exception.
Opera Full support Yes
Notes
Full support Yes
Notes
Notes If a filter contains unrecognized values in its types property, addListener() throws an exception.
Safari Full support 14Firefox Android Full support 48
Notes
Full support 48
Notes
Notes If a filter contains unrecognized values in its types property, addListener() throws an exception.
tabIdChrome Full support YesEdge Full support 14Firefox Full support 53Opera Full support YesSafari Full support 14Firefox Android Full support 53
urlsChrome Full support YesEdge Full support 14Firefox Full support 45
Notes
Full support 45
Notes
Notes Before Firefox 56, moz-extension:// URLs were not allowed.
Opera Full support YesSafari Full support 14Firefox Android Full support 48
Notes
Full support 48
Notes
Notes Before Firefox 56, moz-extension:// URLs were not allowed.
windowIdChrome Full support YesEdge Full support 14Firefox Full support 53Opera Full support YesSafari Full support 14Firefox Android Full support 53

Legend

Full support  
Full support
See implementation notes.
See implementation notes.
Acknowledgements

This API is based on Chromium's chrome.webRequest API. This documentation is derived from web_request.json in the Chromium code.