This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Avoid using it and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
context read-only property of the
Request interface contains the context of the Request (e.g.,
iframe). This defines what sort of resource is being fetched.
The context of a request is only relevant in the ServiceWorker API; a service worker can make decisions based on whether the URL is for an image, or an embeddable object such as a
Note: You can find a full list of the different available contexts including associated context frame types, CSP directives, and platform feature examples in the Fetch spec request context section.
var myContext = request.context;
In the following snippet, we create a new request using the
Request.Request() constructor (for an image file in the same directory as the script), then save the request context in a variable:
var myRequest = new Request('flowers.jpg'); var myContext = myRequest.context; // returns the empty string by default
The definition of 'context' in that specification.
|Living Standard||Initial definition|
|Feature||Android webview||Chrome for Android||Edge mobile||Firefox for Android||Opera Android||iOS Safari||Samsung Internet|
|Basic support||42 — 46||42 — 46||?||No||No||No||?|
1. see bug 1188062 for more information.