Skip to content
Go to file


Failed to load latest commit information.
Latest commit message
Commit time

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:


Simple, static, passive (CDN-compatible) check for third party cookie blocking in a browser



No releases published


No packages published
You can’t perform that action at this time.