且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

chrome开发人员工具中未显示cookie

更新时间:2022-12-18 11:21:05

以下是未实际设置有效cookie的两个潜在原因:

Below are 2 potential reasons for not actually setting a valid cookie:

  1. 无效的到期时间-从浏览器的角度来看,Cookie会在过去的某个时间过期
  2. 无效的域(用于Cookie).假设您从 example.com 提供页面,但是您的服务器尝试为域 google.com
  3. 设置Cookie.
  1. Invalid expiration time - the cookie expires at a time in the past from the browser's perspective
  2. Invalid domain for the cookie. Let's say you serve the page from example.com, but your server tries to set the cookie for domain google.com

chrome开发工具中也可能存在一个错误,即不显示您的cookie,但是您可以通过向服务器发出另一个请求并查看服务器实际收到了哪些cookie,来轻松地进行检查.

There could also be a bug in the chrome dev tools to not show your cookies, but you can check that easily by issuing another request to the server and see what cookies are actually received by the server.