Simple, static, passive (CDN-compatible) check for third party cookie blocking in a browser
Switch branches/tags
Nothing to show
Clone or download
gojko Merge pull request #1 from dennisroche/patch-1
Fixed typo: s/thid/third
Latest commit e58b069 Apr 19, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information. Update Apr 19, 2017
complete.html initial commit Jan 25, 2016
start.html initial commit Jan 25, 2016

Third party cookie check for browsers

A simple, static, passive (CDN-compatible) way of checking if third party cookies are enabled in a browser. Consists of two scripts - one that will set a cookie, and another that will post a message depending on if the cookie is present or not.

Deploy the two scripts somewhere on a different domain from the main application, then load them similar to the example below:

    var receiveMessage = function (evt) {
      if ( === 'MM:3PCunsupported') {
        console.log('third party cookies are not supported');
      } else if ( === 'MM:3PCsupported') {
        console.log('third party cookies are supported');
    window.addEventListener("message", receiveMessage, false);

  <iframe src="LOCATION_OF_THE_SCRIPTS/start.html" style="display:none" />

It's also a good idea to set up a timeout that will automatically label third party cookies as unsupported if no recognised event comes back after a while, just in case network fails.

Live example

Thanks to github pages, the scripts are hosted already at -- so you can use that as a live version. For production, it's better to deploy somewhere under your control.

To see the client code in action, run this JSFiddle: