从Chrome应用访问Cookie [英] Accessing cookies from a chrome app

查看:98
本文介绍了从Chrome应用访问Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以看到,当我从chrome应用程序发出xhr时,它发送了一些cookie,并且这些cookie在应用程序中得到了跟踪.发送set-cookie标头的服务器正在正确更新它们.不过,我需要读取一个cookie,然后尝试使用"cookies"权限,但是chrome对我大吼了……我可以使用另一个api吗?

I can see that when I issue an xhr from my chrome app that it sends some cookies, and these cookies are kept track of in the app. Servers sending set-cookie headers are updating them correctly. I need to read a cookie though, and I tried using the "cookies" permission but chrome yelled at me... Is there another api I can use?

我正在使用新打包的应用程序.

edit: I am using the new packaged apps.

推荐答案

Cookie显然是Chrome打包应用的暗区.

Cookies is apparently a dark area of Chrome Packaged Apps.

使用扩展程序,扩展程序与正常的浏览活动共享cookie罐.对于打包应用程序,每个应用程序都有一个单独的jar.

With Extensions, the extension shares the cookie jar with normal browsing activities. For Packaged Apps, each app has a separate jar.

当前的行为似乎是,对权限部分清单中指定的站点的XHR请求确实在此jar中设置了cookie,但是除重新安装应用程序外,没有其他方法可以摆脱它们.打包应用程序没有用于管理Cookie的API,并且它们的Cookie不会显示在开发者工具或about://settings/cookies页面中.

The current behaviour seems to be that XHR requests to sites specified in the manifest in the permissions section do set cookies in this jar but there is no way how to get rid of them, except reinstalling the app. There is no API for Packaged Apps to manage cookies and their cookies do not show in Developer tools or about://settings/cookies page.

这些臭虫包括

https://code.google.com/p/chromium/问题/详细信息?id = 70391 https://code.google.com/p/chromium/issues/detail ?id = 152758 https://code.google.com/p/chromium/issues/detail ?id = 157474

这两个问题填补了对这个SO问题的回应

and these two issues filled in response to this SO question

https://code.google.com/p/chromium/问题/详细信息?id = 236585 https://code.google.com/p/chromium/issues/detail ?id = 335934

这篇关于从Chrome应用访问Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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