且构网

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

如何从JavaScript获取Cookie到期日期/创建日期?

更新时间:2023-01-15 11:00:33

这些信息不能通过document.cookie获得,但如果你真的绝望,可以尝试通过XmlHttpRequest对象到当前页面执行请求,并使用getResponseHeader()访问cookie头。

The information is not available through document.cookie, but if you're really desperate for it, you could try performing a request through the XmlHttpRequest object to the current page and access the cookie header using getResponseHeader().