webRequest.RequestFilter

webRequest事件参数

Type

该参数值是一个对象,包括以下属性:

urls
字符串数组类型,数组内的每个字符串为模式匹配格式。当请求地址符合给定模式时,事件监听器才会响应。需注意的是,仅支持http和HTTPS协议的参数地址,其他协议即使与该给定模式匹配也不会响应。
types可选
webRequest.ResourceType类型的数组,表示资源类型列表。例如:stylesheets、images、scripts。事件监听器仅响应出现在该指定列表的资源类型。
tabId可选
数值类型,与tab关联,事件监听器仅响应指定了该tabId的请求。
windowId可选
数值类型,与window关联,事件监听器仅响应指定了该windowId的请求。

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxOperaFirefox for Android
RequestFilterChrome Full support YesEdge Full support 14Firefox Full support 45Opera Full support YesFirefox Android Full support 48
tabIdChrome Full support YesEdge Full support 14Firefox Full support 53Opera Full support YesFirefox 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 YesFirefox 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 YesFirefox Android Full support 53

Legend

Full support  
Full support
See implementation notes.
See implementation notes.
告知信息

该API基于Chromium的 chrome.webRequest API. 该文档来源于Chromium代码中的 web_request.json

Microsoft Edge兼容性数据由Microsoft Corporation提供,并包含在Creative Commons Attribution 3.0 United States License下。