我想知道是否可以跟踪用户从开发者控制台手动删除的仅 HTTP cookie。我知道当用户刷新页面时,就会发生变化。是否可以在用户使用 MERN 堆栈和 axios 手动删除仅 HTTP 的 cookie 后立即跟踪更改并注销用户?
我尝试使用 axios 拦截器,但似乎不起作用
不幸的是,在客户端跟踪仅 HTTP cookie 的立即删除是不可行的,因为:
1. HTTP-only cookies are inaccessible to JavaScript: By design, these cookies cannot be accessed or modified via JavaScript, making them secure against XSS attacks. Therefore, JavaScript can’t detect when a user manually deletes an HTTP-only cookie through the developer console.
2. No real-time event listener for cookie changes: Browsers do not provide an event or API that notifies you when cookies are deleted, updated, or expired. This limitation prevents real-time tracking of cookie deletion.
我鼓励您更多地了解网络协议的一般工作原理。