每个 Web 请求都会发送浏览器 cookie 吗? [英] Does every web request send the browser cookies?

查看:34
本文介绍了每个 Web 请求都会发送浏览器 cookie 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每个网络请求都会发送浏览器的 cookie 吗?

Does every web request send the browser's cookies?

我不是在谈论页面浏览量,而是对图像、.js 文件等的请求

I'm not talking page views, but a request for an image, .js file, etc.

更新如果一个网页有 50 个元素,那就是 50 个请求.为什么它会为每个请求发送相同的 cookie,它不缓存或不知道它已经拥有它?

Update If a web page has 50 elements, that is 50 requests. Why would it send the SAME cookie(s) for each request, doesn't it cache or know it already has it?

推荐答案

可以,只要请求的 URL 位于 cookie 中定义的相同域和路径内(以及所有其他限制——安全、httponly、不expired 等)hold,那么每次请求都会发送 cookie.

Yes, as long as the URL requested is within the same domain and path defined in the cookie (and all of the other restrictions -- secure, httponly, not expired, etc) hold, then the cookie will be sent for every request.

这篇关于每个 Web 请求都会发送浏览器 cookie 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆