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
ofstring
. 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.view-source:
requests may be matched based on its inner URL.types
Optionalarray
of
. 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.webRequest.ResourceType
tabId
Optionalinteger
. The listener will only be called for requests from thetab
identified by this ID.windowId
Optionalinteger
. The listener will only be called for requests from thewindow
identified by this ID.incognito
Optionalboolean
. If provided, requests that do not match the incognito state (true
orfalse
) will be filtered out.
Browser compatibility
Report problems with this compatibility data on GitHubwebextensions-desktop | webextensions-mobile | |||||
---|---|---|---|---|---|---|
RequestFilter | ChromeFull supportYes
| EdgeFull support14
| FirefoxFull support45
| OperaFull supportYes
| SafariFull support14 | Firefox for AndroidFull support48
|
tabId | ChromeFull supportYes | EdgeFull support14 | FirefoxFull support53 | OperaFull supportYes | SafariFull support14 | Firefox for AndroidFull support53 |
urls | ChromeFull supportYes | EdgeFull support14 | FirefoxFull support45
| OperaFull supportYes | SafariFull support14 | Firefox for AndroidFull support48
|
view-source | ChromeFull supportYes | EdgeFull support14 | FirefoxFull support84 | OperaFull supportYes | SafariNo supportNo | Firefox for AndroidNo supportNo |
windowId | ChromeFull supportYes | EdgeFull support14 | FirefoxFull support53 | OperaFull supportYes | SafariFull support14 | Firefox for AndroidFull support53 |
Legend
- Full support
- Full support
- No support
- No support
- See implementation notes.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Acknowledgements
This API is based on Chromium's chrome.webRequest
API. This documentation is derived from web_request.json
in the Chromium code.