Fetch with Credentials

JavaScripts in this page will set document.cookie to ..., which will be reflected by the server and all request headers are printed as following:

Click following buttons to fetch...


ServiceWorkerGlobalScope.fetch() attach cookies by default.


window.fetch(url, options) will not attach cookies by default. Setting the credentials options will do this trick.


XMLHttpRequest.send() will attach cookies by default, withCredentials is needed only in CORS requests.