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

tou*_*tpt 6 cookies session-cookies etherpad

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

Portal places the cookie "sessionID" with the given value on the client and creates an iframe including the pad.
Run Code Online (Sandbox Code Playgroud)

除了饼干之外,每件事都很顺利.阅读文档最好的实践似乎使etherpad-lite在特定路径下的同一域中.这就是我使用/ pad/path所做的.

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

结果,我的cookie被添加到主页面的请求中,但不是if 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

use*_*584 3

对于后代,以下是@AskoSoukka在上面的评论中确定并“接受”的答案:

存储在浏览器中的实际 cookie 是什么样子的?也许,您需要在 setCookie kwargs 中显式指定 path="/" 才能使其适用于整个域。