title: YouTube API and cross origin requests
body: <p>Has YouTube started locking down cross origin requests?</p>
  
  <p>I am using a fullscreen autoplay hero video on my website and it has been functioning correctly for a long time. Within the last couple weeks it stopped working and I have the following error in the logs.</p>
  
  <blockquote>
    <p>Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('<a href="https://www.youtube.com" rel="noreferrer">https://www.youtube.com</a>') does not match the recipient window's origin ('<a href="https://tbrogames.github.io" rel="noreferrer">https://tbrogames.github.io</a>').</p>
  </blockquote>
  
  <p>Per the answer on this <a href="https://stackoverflow.com/questions/27573017/failed-to-execute-postmessage-on-domwindow-https-www-youtube-com-http">question</a></p>
  
  <p>I tried changing the host between http and https to see if that would fix it and it didn't.</p>
  
  <p>My website that throws the error: <a href="https://tbrogames.github.io/" rel="noreferrer">https://tbrogames.github.io/</a></p>
  
  <p><strong>I was able to find a bigger games website that also has this exact issue.</strong>
  <a href="https://playbattlegrounds.com/main.pu" rel="noreferrer">https://playbattlegrounds.com/main.pu</a></p>
  
  <p>They are also using a youtube video as the hero/splash video; and it no longer functions, throwing the same error.</p>
  
  <p>The relevant javascript can be found here
  <a href="https://github.com/tbrogames/tbrogames.github.io/blob/master/js/defer.js" rel="noreferrer">https://github.com/tbrogames/tbrogames.github.io/blob/master/js/defer.js</a></p>
  
  <p>However, this was working for a long time and I didn't change any of the code. Which is why I'm thinking that it is a change that YouTube has made.</p>