title: How to detect if Prevent Cross-site tracking is active on Safari 13 with javascript
body: <p>I would like to detect when Prevent Cross-site tracking is active in a browser using JavaScript.</p>
  <p>My challenge is trying to find a method to detect this and show a warning popup to the user when this cross-site tracking is disabled by a users browser. This became essential after Safari 13 disabled it as default. I believe this might be helpful for people who are using cookies on iframes.</p>
  <p>There are some ways such as</p>
  <p><a href="https://stackoverflow.com/questions/3550790/check-if-third-party-cookies-are-enabled">Check if third-party cookies are enabled</a></p>
  <p>and</p>
  <p><a href="https://gist.github.com/iansltx/18caf551baaa60b79206" rel="noreferrer">https://gist.github.com/iansltx/18caf551baaa60b79206</a></p>
  <p>which are trying to bypass this security feature with using different methods and some of them are not valid anymore.</p>
  <p>Basically what I try to achieve is from an iframe, try to detect Prevent Cross-site tracking is enabled on the browser using JavaScript.</p>
  <p>I tried using this code:</p>
  <pre><code>var receiveMessage = function (evt) {
    if (evt.data === 'MM:3PCunsupported') {
      document.getElementById('result').innerHTML = 'not supported';
    } else if (evt.data === 'MM:3PCsupported') {
      document.getElementById('result').innerHTML = 'supported';
    }
  };
  window.addEventListener(&quot;message&quot;, receiveMessage, false);
  </code></pre>
  <p>However, this solution doesn't seem to work any more.</p>