cookies - 如何在同一域上为 iframe 设置 cookie

标签 cookies session-cookies etherpad

我正在尝试按照官方文档 http://etherpad.org/doc/v1.2.7/ 的示例 1 将 etherpad-lite 集成到 CMS Plone 中

Portal places the cookie "sessionID" with the given value on the client and creates an iframe including the pad.

除了 cookie 之外,一切都很顺利。阅读文档的最佳实践似乎是使 etherpad-lite 在特定路径下的同一域中。这就是我使用/pad/路径所做的。

如果没有创建 session ,我会在 Plone 端创建,添加一个 cookie,然后重定向到同一页面,以确保 cookie 在浏览器中。

结果,我的 cookie 被添加到主页的请求中,但没有添加到 iframe 请求中。

这是主页和 iframe 的 google chrome 控制台网络选项卡:

http://toutpt.makina-corpus.org/en/images/cookie-in-iframe/

setCookie对应的代码位于https://github.com/toutpt/collective.etherpad/blob/master/collective/etherpad/archetypes.py#L100

最佳答案

对于后代,这里是 the answer来自@AskoSoukka在上面的评论中确定并“接受”:

How does the actual cookie stored in you browser look like? Probably, you need to explicitly specify path="/" in setCookie kwargs to make it work for the whole domain.

关于cookies - 如何在同一域上为 iframe 设置 cookie,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14836834/

相关文章:

php - 在 cookie 中存储 PHP 数组

php - 登录 ISP Config 永远破坏了我的 PHP session 和 cookie

c# - 使用 angular js 读取 Set-Cookie 头信息并维护用户 session

html - HTML 中的稳健行号(文本换行和字体大小更改)

node.js - 无法使用 NodeJS 和 Redis 进行 SET/GET

apache - 将 Etherpad 安装到子目录中

android - HttpCookie.hasExpired() 在 Nougat 之前无法正常工作 (24)

asp.net - 将 Request.ApplicationPath 用于 cookie 路径是否安全

javascript - 删除 cookie 的 JavaScript

tomcat - 浏览器 session 超时