How to set a cookie for iframe on the same domain

こ雲淡風輕ζ 提交于 2019-12-08 20:34:59

问题


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.

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.

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.

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

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

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

The code corresponding to the setCookie is at https://github.com/toutpt/collective.etherpad/blob/master/collective/etherpad/archetypes.py#L100


回答1:


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

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.



来源:https://stackoverflow.com/questions/14836834/how-to-set-a-cookie-for-iframe-on-the-same-domain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!