Failed to execute ‘postMessage’ on ‘DOMWindow’

I keep receiving “Failed to execute ‘postMessage’ on ‘DOMWindow’: The target origin provided (‘’) does not match the recipient window’s origin (‘’).”

The issue is with the www. The video plays but it just keeps throwing the above error repeatedly.
I’ve tried adding “www” to the source link, but then it returns a 404 for the video. I’m still not having any luck. Any ideas?

Here are the code snippets

$(document).ready(function() {
        // Add custom contents from html file using an iframe:
        $('body').append('<div id="iframe-o" style="visibility: hidden; 
position: relative; display: table; margin: auto;"><div id="iframe-m" 
style="display: table-cell; vertical-align: middle;"><div id="iframe-i" 
style="display: inline-block; width:100%; overflow-y: auto; 
overflow-x: hidden;"><iframe id="iframe" src="'+src+'" style="width: 100%; height: 100%;">
<!doctype html>

<html style="width: 100%; height: 100%;">
    <meta charset="UTF-8">
    <meta name="viewport" content="user-scalable=no">
    <script src=""></script>
    .player {
    pointer-events: none;
    position: absolute;
  <body style="width: 95vw; height: 95vh; position: relative;">
    <iframe class="ytplayer" id="player" style="width: 60%; 
height: 60%; display: block; position: absolute; top: 60%; 
left: 60%; transform: translate(-50%, -50%);" 
    <script type="text/javascript">
      var player;
      function onYouTubeIframeAPIReady() {
        player = new YT.Player('player', {
          videoId: 'kpCJyQ2usJ4',
          events: {
            'onStateChange': function(e){
              if( == 0){
                parent.$('continueRoutine', false);

Any help would be appreciated.

This was not the case about 5 months ago. So, I do not know if this is a result of a recent update in the site’s infrastructure or what.