How does Facebook set cross-domain cookies for iFrames on canvas pages?

So the iFrame isn’t actually setting the u cookie for the runwithfriends.appspot.com domain. What Facebook does is it creates a form, <form action="runwithfriends.appspot.com/..." target="name_of_iframe" method="POST"> and uses javascript to submit the form on page load. Since the form’s target is the iframe, it doesn’t reload the page… it just loads the iframe with the POST’s response. Apparently even Chrome and other browsers with strict cookie policies set cookies for cross domain requests if they are POST requests…

Leave a Comment