Value
A string with one of the following values:
omit-
Never send credentials in the request or include credentials in the response.
same-origin-
Only send and include credentials for same-origin requests. This is the default.
include-
Always include credentials, even for cross-origin requests.
Examples
In the following snippet, we create a new request using the Request() constructor (for an image file in the same directory as the script), then save the request credentials in a variable:
js
const request = new Request("flowers.jpg");
const credentials = request.credentials; // returns "same-origin" by default
Specifications
| Specification |
|---|
| Fetch # ref-for-dom-request-credentials② |