Javascript 您如何在 Internet Explorer 中查看会话 cookie?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6051811/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 20:02:34  来源:igfitidea点击:

How do you view session cookies in Internet Explorer?

javascriptinternet-explorersession-cookies

提问by treaint

I am able to see session cookies in Firefox 3.6 by going to

我可以通过以下方式查看 Firefox 3.6 中的会话 cookie

Tools->Options->Privacy->Remove Individual Cookies

工具->选项->隐私->删除个人cookies

How do I see those same session cookies in IE (6/7/8)?

我如何在 IE (6/7/8) 中看到相同的会话 cookie?

Tools->Internet Options->Browsing history Settings->View files

工具->Internet 选项->浏览历史设置->查看文件

only contains persistent cookies

仅包含持久性 cookie

Also how do I access them programmatically? In Firefox I use the nsICookieManagerinterface to read the session cookies, does IE contain an equivalent interface?

另外我如何以编程方式访问它们?在 Firefox 中,我使用该nsICookieManager界面读取会话 cookie,IE 是否包含等效的界面?

回答by EricLaw

Cookies set with the HTTPOnlyattribute will not be visible to Javascript (e.g. via the document.cookieaccessor). In IE8, 9, and 10, hit F12 to open the Developer Tools. Click Cache > View Cookie Information to see persistent and session cookies that apply to the current domain.

使用该HTTPOnly属性设置的 Cookie对 Javascript 不可见(例如,通过document.cookie访问器)。在 IE8、9 和 10 中,按 F12 打开开发人员工具。单击缓存 > 查看 Cookie 信息以查看适用于当前域的持久性和会话 cookie。

This feature is not present in the IE11 version of the tools, which would mean that your choices are 1> Watch outbound Cookie headers in Fiddler or on the Network tab, or 2> Write a plugin that calls the InternetGetCookieExAPI with the appropriate flag to include HTTPOnlycookies.

此功能在 IE11 版本的工具中不存在,这意味着您的选择是 1> 在 Fiddler 中或在网络选项卡上观察出站 Cookie 标头,或 2> 编写一个插件,InternetGetCookieEx使用适当的标志调用API 以包含HTTPOnly饼干。

回答by Dr.Molle

Type into adress-bar:

在地址栏中输入:

javascript:alert(document.cookie)

to see the cookies that are currently readable by javascript.

查看当前可由 javascript 读取的 cookie。

Regarding to the read/write of session-cookies:
Why do you need to do it using javascript? usually session-cookies are needed to have an relation to serverside stored data, so you need to manage the cookies from serverside, no matter what browser there may be.

关于会话cookies的读/写:
为什么你需要使用javascript来做?通常需要 session-cookies 来与服务器端存储的数据建立关系,所以你需要从服务器端管理 cookie,不管有什么浏览器。

回答by Mohammad Rahman

F12-> Network Tab -> Enable Network Capture Traffic Capturing - > Details Tab -> Request Header Tab.

F12-> 网络选项卡-> 启用网络捕获流量捕获-> 详细信息选项卡-> 请求头选项卡。

Snap Shot

快照