问题描述
我正在制作一个 Javascript Windows 8 应用程序,用户在该应用程序中连接到我的服务器并登录.目前,我正在尝试使用 XmlHttpRequest 对象来执行此操作(特别是 WinJS.xhr),但是当我得到getAllResponseHeaders(),Set-Cookie 标头不存在(因为它是一个 Http-only cookie).
I am making a Javascript Windows 8 app in which the user connects to my server and logs in. Currently, I am trying to use the XmlHttpRequest Object to do so (specifically, WinJS.xhr) but when I get the output of getAllResponseHeaders(), the Set-Cookie header isn't there (because it is an Http-only cookie).
有没有办法从 JS Windows 8 应用程序中获取仅限 http 的 cookie?
Is there any way to get http-only cookies from a JS Windows 8 app?
非常感谢所有帮助,我总是接受答案!
All help is greatly appreciated and I always accept an answer!
推荐答案
事实证明,Windows 8 应用程序已经能够通过响应标头中的 XMLHttpRequest 获取仅限 HTTP 的 cookie.但是,系统会以与 iOS 相同的方式自动处理 cookie.这看起来很合乎逻辑,因为 coder 不应该负责 cookie 处理,底层框架会这样做.
As it turns out, Windows 8 apps are already able to get HTTP-only cookies with the XMLHttpRequest from the response's header. However, the system handles the cookies automatically in the same way iOS does. This seems very logical, since the coder should not be responsible for cookie handling, the underlying framework does that.
这篇关于从 Windows 8 JS 应用程序获取仅 HTTP cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!