如何从JavaScript获取Cookie到期日期/创建日期? [英] How to get cookie expiration date / creation date from javascript?

查看:162
本文介绍了如何从JavaScript获取Cookie到期日期/创建日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以从javascript检索现有Cookie的创建或过期日期?如果是这样,

Is it possible to retrieve the creation or expiration date of an existing cookie from javascript? If so how?

推荐答案

这些信息不能通过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().

这篇关于如何从JavaScript获取Cookie到期日期/创建日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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