Suppose I have a site at www.example.com which has an IFRAME pointing to ASP.NET site myapp.othersite.com - this causes issues with session and 3rd-party cookies which I understand.
If I moved the embedded app to myapp.example.com, would the session cookie still count as a 3rd-party cookie as it is a different subdomain?
Please everyone note that you can set a cookie from a subdomain on a domain. But you CAN'T set a cookie from a domain on a subdomain.
To share cookies across subdomains, you can simply create cookies with the domain directive set to the parent domain, in this case, example.com, rather than either of the specific subdomains.
Third-Party Cookies are cookies that are set by a website other than the one you are currently on. For example, you can have a "Like" button on your website which will store a cookie on a visitor's computer, that cookie can later be accessed by Facebook to identify visitors and see which websites they visited.
To share a cookie between domains, you will need two domains, for example myserver.com and slave.com . One of the domains will issue the cookies and the other domain will ask the first domain what cookie should be issued to the client.
Cookies seem to be considered 3rd party if they come from different base domains (base domains being example.com
or example.co.uk
), but not if they come from different subdomains of the same base domain.
myapp.example.com
will be able to set cookies with domain myapp.example.com
if it is embedded within www.example.com
.
Having myapp.example.com
set cookies with domain .example.com
is unnecessary unless those cookies need to be read from a different subdomain.
[Tested in Firefox, Chrome (with 3rd party cookies blocked) and Safari] [ThirdPartyUtil.IsThirdPartyInternal seems to be where this is checked in Firefox]
if you set a Cookie on domain .example.com
then a cookie from www.example.com and www.myapp.example.com will be considered the same.
no cookie is treated as a 3rd party cookie.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With