X-Domain Cookies in iFrames
I have a domain A.com which is my website. I want to allow the user to login and then I have embedded an iframe into domain B.com which attempts to grab the cookie from A.com to allow the user to be continued to be signed in.
I can't seem to get this working in I开发者_C百科E ? A new session gets set instead and the cookie is never retrieved.
I have set a P3P policy ? Any ideas what I am doing wrong.
B.com is not going to be able to access cookies from A.com. I think you are confusing third-party cookies with cross-domain cookies. With a third-party cookie (which P3P is relevant to), B's content (e.g. http://b.com/foo.png) is included on http://a.com and sets its own cookie. That doesn't allow A or B to read each other's cookies though.
If you want A and B to communicate on the client side, you can use hacks like fragment id messaging, or developing functionality like postMessage
精彩评论