我知道,对于跨同一浏览器的选项卡或窗口发出的请求,cookie 会从客户端(网络浏览器)发送到服务器( www.example.com )。因此,对于给定域,http cookie 在不同浏览器选项卡中是相同的。
但根据我的经验,http header 的情况并非如此。如果浏览器选项卡访问服务器 ( www.example.com ) 并且服务器发送 header - "mycustomeheader: "i am example.com"
,则此 header 将不可用于同一位置的其他选项卡浏览器窗口或同一浏览器的其他窗口。
以上理解正确吗?
最佳答案
是的,因为 HTTP header 是针对每个请求的,因为您发送或期望每个请求发送或期望 JSON/XML/HTML,例如内容长度 header 值通常会有所不同,具体取决于请求正文
但是 cookies 是 per domain
Every time your browser makes an http request, it checks the (local) cookie database for any cookies that have a domain matching that of the request; if it finds any, it sends them along to the server
关于http - http header 是否在浏览器选项卡之间共享?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69401725/