Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
202 views
in Technique[技术] by (71.8m points)

javascript - When is a cookie considered to be a third party cookie?

Example:

There is a cookie set on website A and another cookie set on website B. I have open website A in my browser and this website sends an AJAX request to website B. In the context of this request, is the cookie for website A or is the cookie for website B considered a third party cookie?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If website B sets a cookie on your website A, then it'll be considered a third party cookie for website A, It's quite simple.

Secondly, cookies are set by servers, so it may not be right to say "Website B has cookies", Probably you mean to say that Websites B sets some cookies, and Website A sets some cookies on client.

So, if website A contains an ad that is served by website B, then website B can set a cookie in your browser. For example, maybe website A uses <iframe src="http://websiteB.com/ad.html> to serve the ad from website B. Then when your browser goes to fetch http://websiteB.com/ad.html, the response will come back with a Set-Cookie header that sets a cookie with some unique random string. If website C also includes an ad from website B, then that unique cookie will be sent when the ad on website C is fetched from website B.

Here's this question with very detailed answer


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...