4 ms·
I read that and understood how it would be beneficial, but not how it would be possible. Say I own x.com, and y.com and even have them both being served from th
by sopooneo 13y ago
I read that and understood how it would be beneficial, but not how it would be possible. Say I own x.com, and y.com and even have them both being served from the same box. If a user requests a page for x.com, how can I get them to accept a cookie for y.com?
- Tarang 13y agoI was thinking the same thing. As I understand it it's possible only to do for subdomains. I suppose one way of doing it is with some kind of script that links up to a prehosted theguardian.com so the cookie is set from where the js is included from.
- untog 13y agoYou could place an invisible iframe on the page. Ugly, but possible.
- jules 13y agoOn the old domain, make a request to the new domain with query parameters that have the information necessary to login as that user. You can do this using e.g. a hidden image, an iframe, or using javascript. The request on the new domain saves that login information in a cookie.
- sopooneo 13y agoOf course. I should have thought of that. Thank you.
- bpeebles 13y agoYou could do it through redirects to from x.com to y.com/login, which sets cookies on y.com's domain, and then redirects back to x.com. Either only do it on login or set another cooking on x.com once you've done it once. (I actually work on a web property that does similar, although for different reasons.)
- yahelc 13y agoThe other answers to your question are technically all feasible, but are all extremely unlikely to be how this was actually done. This is just what third party cookies are. Cookies set from the server-side (ie, the Set-Cookie header) can set whatever domain they want -- and if that cookie happens to not match the domain of the page you're on, that's what's called a third party cookie. Some browsers (primarily Safari IIRC), however, will automatically reject those cookies, either in all instances or depending on if you've interacted with that domain before.
- sopooneo 13y agoThank you, and I appreciate learning. But I think I'm reading something else on wikipedia. The article there says you can only set cookies on "the top domain and its subdomains" [1] and that third party cookies are those set by page assets (like images within a page) that are served from a different domain. [2] What do you think? [1] http://en.wikipedia.org/wiki/HTTP_cookie#Domain_and_Path http://en.wikipedia.org/wiki/HTTP_cookie#Domain_and_Path [2] http://en.wikipedia.org/wiki/HTTP_cookie#Third-party_cookie http://en.wikipedia.org/wiki/HTTP_cookie#Third-party_cookie
- judk 13y agoYou are correct. Parent is mistaken.
- yahelc 13y agoMy point was that the domain of the top URL you're on isn't relevant. Should have been clearer that the domain of the request itself needs to match.
- yahelc 13y agoAh, yes. I should have been clearer in my comment. Obviously, the request needs to be served from the domain or subdomain in question, but it doesn't need match the URL of the page you're on, and it doesn't need to be an iframe, nor be set by JavaScript. It can be a simple image request; doesn't need to be an iframe, and doesn't need to involve complex JavaScript. My point was that it doesn't need to require much complexity at all; just an HTTP request served by the domain in question that passes along the cookies that need to be served from the new domain.