views:

37

answers:

1

I have an application that needs to check whether the client browser has third-party-cookies enabled. Does anyone know how to do this in Javascript?

A: 

In theory you'd just have a page call out somewhere that would set a thirdparty cookie and then check for that cookie's existence. However, standard browser security does not allow scripts from domain A to do anything with cookies set on domains B,C,etc... e.g. you can't access "foreign" cookies.

If you have some specific usage in mind, such as checking if ads are blocked (which would also block the 3rd party tracking cookie), you could check if the ad server's content is within the page's DOM, but you couldn't see if the cookie's there.

Marc B
Indeed I've tried that, but it doesn't work. We're actually running an application for a white label on the white labels domain, but we want to place our own cookies. The default check for cookies isn't sufficient because our cookies are regarded third party. We'll now try a different approach.
Maurits de Boer