title: Cookies - set across multiple domains
body: <p>My company has a setup as follows:</p>
  
  <ul>
  <li>subdomain1.domain1.com</li>
  <li>subdomain2.domain1.com</li>
  <li>subdomain3.domain1.com</li>
  <li>subdomain4.domain1.com</li>
  <li>subdomain5.domain1.com</li>
  <li><p>subdomain6.domain1.com</p></li>
  <li><p>subdomain1.domain2.com</p></li>
  <li>subdomain2.domain2.com</li>
  <li>subdomain3.domain2.com</li>
  <li>subdomain4.domain2.com</li>
  <li>subdomain5.domain2.com</li>
  <li>subdomain6.domain2.com</li>
  </ul>
  
  <p>On each site, bearing in mind there can be a hundred sites per subdomain, users can log in. We, as developers, have to test frontends across several browsers, but some work may only be required on a section once logged in.</p>
  
  <p>I have written a userscript which enables us to save a username and password (and other details which I cannot mention because of confidentiality). The script checks to see if the user account exists by filling in the login form and clicking the submit button. If not, it registers for us - thus automating the registration process.</p>
  
  <p>Sharing cookies between subdomains on the same domain is easy. If I am on subdomain1.domain1.com I can save a cookie which can be retrieved by subdomain2.domain1.com. However, I would also like to save these for domain2. I do not appear to be able to get this to work.</p>
  
  <p>I can see two solutions from here - either:</p>
  
  <p>1) attach an iFrame using the userscript, which loads a site on domain2. This then uses the querystring to decide what to set to what, or;</p>
  
  <p>2) use a form with method="POST", and simply post to a file on each domain.</p>
  
  <p>Either way will be resource intensive, particularly if the cookies are updated each time a cookie changes. We also have URL masking in place. So we'd also have to take into account sites like abc.clientdomain1.com, abc.clientdomain2.com etc.</p>
  
  <p>Does anyone know of an easier way to do achieve this?</p>