如何在同一域上为iframe设置Cookie

如何在同一域上为iframe设置Cookie

本文介绍了如何在同一域上为iframe设置Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在按照官方文档的示例1

I'm trying to make integration of etherpad-lite in the CMS Plone, following Example 1 of the official documentation http://etherpad.org/doc/v1.2.7/

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

除cookie之外,其他所有功能都运行良好。阅读文档的最佳实践似乎使etherpad-lite在特定路径下的同一域中。这是我使用/ pad /路径完成的操作。

Everythings goes well except for the cookie. Reading documentation the best pratice seems to make etherpad-lite in the same domain under a specific path. This is what I have done using /pad/ path.

如果没有创建会话,则创建克隆端,然后创建一个cookie,然后添加一个cookie

Plone side if no session has been created, I created on, I add a cookie and then I'm doing a redirect to the same page to be sure the cookie is in the browser.

因此,我的cookie被添加到主页的请求中,而不是iframe。

As a results my cookie is added to the request of the main page but not ob the iframe request.

这是主页和iframe的google chrome控制台网络标签:

Here is the google chrome console network tab for the main page and the iframe:

与setCookie对应的代码在来自在上面的评论中被识别并接受:

For posterity, here's the answer from @AskoSoukka identified and "accepted" in the comments above:

这篇关于如何在同一域上为iframe设置Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 16:49