Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

webRequest.BlockingResponse

An object of this type is returned by event listeners that have set "blocking" in their extraInfoSpec argument.

By setting particular properties in BlockingResponse, the listener can modify network requests.

Note that you can't set all this object's properties in every listener: the properties you can set are dependent on the event that triggered this listener, as detailed below.

Type

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

cancelOptional
boolean. If true, the request is cancelled. You can only set this property in onBeforeRequest, onBeforeSendHeaders, and onAuthRequired.
redirectUrlOptional
string. This is a URL, and if set, the original request is redirected to that URL. You can only set this property in onBeforeRequest or onHeadersReceived.
Redirections to non-HTTP schemes such as data: are allowed, but they are not currently supported (bug 707624). Redirects use the same request method as the original request unless initiated from onHeadersReceived stage, in which case the redirect uses the GET method.
requestHeadersOptional

webRequest.HttpHeaders. This is an HttpHeaders object, an array in which each object represents a header. If set, the request is made with these headers rather than the original headers. You can only set this property in onBeforeSendHeaders .

responseHeadersOptional
webRequest.HttpHeaders. This is an HttpHeaders object, an array in which each object represents a header. If set, the server is assumed to have responded with these response headers instead of the originals. You can only set this property in onHeadersReceived.
authCredentialsOptional
object. If set, the request is made using the given credentials. You can only set this property in onAuthRequired. The authCredentials property is an object with the following properties:
username
string. Username to supply.
password
string. Password to supply.

Browser compatibility

Chrome Edge Firefox Firefox for Android Opera
Basic support Yes Yes 45.0 48.0 33

Acknowledgements

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

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

Document Tags and Contributors

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