Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why new js Fetch standard forbid response header name as 'Set Cookie 1 / 2'?

I'm very surpised that https://fetch.spec.whatwg.org/ standard doesn't allow to set cookie from server. I expected New Fetch will be awesome alternative of XHR thing, but...

Does anybody knows any official answer for it? Thanks in advance!

like image 524
Alerkesi Avatar asked Jan 24 '26 00:01

Alerkesi


1 Answers

What you state is incorrect. The server can definitely set cookies, but as with XMLHttpRequest you cannot access them from the API. The only way to observe cookies from JavaScript is document.cookies and we decided not to increase the number of places since we haven't found a good way to do that, while also respecting cookie flags such as HttpOnly.

like image 157
Anne Avatar answered Jan 26 '26 13:01

Anne