Cross domain cookie reading/setting cross browsers

Posted by Rac123 on Stack Overflow See other posts from Stack Overflow or by Rac123
Published on 2010-02-24T18:30:35Z Indexed on 2010/05/04 17:48 UTC
Read the original article Hit count: 452

Filed under:
|

I know there are already a few threads available here on this subject but I want others' opinion on this.

There are two ways to set/read the cross domain cookies:

  1. Creating IFrame on A.com pointing to a page on B.com which creates the cookie and pass that information by creating another IFrame on B.com side pointing to A.com, either using window.name or in location.href.hash
  2. A.com page makes a XHR/JSONP call to B.com web service/page that has the following headers and it also sets up the cookie and returns the value.

AddHeader("p3p", "CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"")

As we don't have postMessage available across all the browsers, I believe we have to go with one of the cases mentioned above.

My question is which is a better way (cleaner) and why to implement for cross browser. Using any other JS framework is out of scope of this discussion. If there's another better way, please mention here!

Thank you for your intelligent input in advance! :)

© Stack Overflow or respective owner

Related posts about cross-domain

Related posts about cross-browser