title: Youtube Unsafe JavaScript attempt to access frame with URL
body: <p>Here I am with another question, this time about the youtube API.
  I'm using this code to get a youtube player:</p>
  
  <pre><code>&lt;div id=\"youtubeVideoContainer\"&gt;&lt;/div&gt;&lt;script type=\"text/javascript\"&gt;
                          //Load player api asynchronously.
                          var tag = document.createElement('script');
                          tag.src = \"//www.youtube.com/player_api\";
                          var firstScriptTag = document.getElementsByTagName('script')[0];
                          firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
  
                          var player;
                          function onYouTubePlayerAPIReady() {
                              player = new YT.Player('youtubeVideoContainer', {
                                height        : \"".$height."\",
                                width         : \"".$width."\",
                                videoId       : \"".$id."\",
                                playerVars    : ".json_encode($this-&gt;playerParams)."
                              });
                          }
                      &lt;/script&gt;
  </code></pre>
  
  <p>Please don't mind the \", it is rendered in PHP, so it's just for escaping, also, the video is playing, so no major errors :)</p>
  
  <p>What does annoy me, is everytime I request a video, I see this message in my console:
  Unsafe JavaScript attempt to access frame with URL </p>
  
  <blockquote>
    <p><a href="https://www.socialthisday.com/playwin/admin/content/edit/project_1/home.html">https://www.socialthisday.com/playwin/admin/content/edit/project_1/home.html</a>
    from frame with URL
    <a href="https://www.youtube.com/embed/2UJH9dCtp7w?autohide=1&amp;autoplay=1&amp;controls=0&amp;border&amp;cc_load_policy=0&amp;color&amp;color1&amp;color2&amp;disablekb&amp;enablejsapi=1&amp;egm&amp;fs&amp;hd&amp;iv_load_policy&amp;loop&amp;modestbranding=1&amp;origin=https%3A%2F%2Fwww.socialthisday.com&amp;playerapiid&amp;playlist&amp;rel=0&amp;showinfo=0&amp;showsearch&amp;start&amp;theme&amp;version=3">https://www.youtube.com/embed/2UJH9dCtp7w?autohide=1&amp;autoplay=1&amp;controls=0&amp;border&amp;cc_load_policy=0&amp;color&amp;color1&amp;color2&amp;disablekb&amp;enablejsapi=1&amp;egm&amp;fs&amp;hd&amp;iv_load_policy&amp;loop&amp;modestbranding=1&amp;origin=https%3A%2F%2Fwww.socialthisday.com&amp;playerapiid&amp;playlist&amp;rel=0&amp;showinfo=0&amp;showsearch&amp;start&amp;theme&amp;version=3</a>.
    Domains, protocols and ports must match.</p>
  </blockquote>
  
  <p>I would like to fix this so I don't see that message. I know it isn't really a major thing, but I like to now how I can get a youtube player on my site without seeing the warning above.</p>
  
  <p>Hopefully you guys can help me out!</p>
  
  <p>EDIT:
  This is the output:</p>
  
  <pre><code>&lt;div id="YTcontainer_502513c7ebc1b"&gt;&amp;nbsp;&lt;/div&gt;
                          &lt;script type="text/javascript"&gt;
                              //Load player api asynchronously.
                              var tag = document.createElement('script');
                              tag.src = "//www.youtube.com/iframe_api";
                              var firstScriptTag = document.getElementsByTagName('script')[0];
                              firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
  
                              var YTplayer_502513c7eb834;                                                        
                              window.onYouTubeIframeAPIReady = function() {
                                  YTplayer_502513c7eb834   = new YT.Player("YTcontainer_502513c7ebc1b", {
                                    height        : "200",
                                    width         : "200",
                                    videoId       : "2UJH9dCtp7w",
                                    playerVars    : {"autohide":1,"autoplay":1,"controls":0,"border":"","cc_load_policy":0,"color":"","color1":"","color2":"","disablekb":"","enablejsapi":"","egm":"","fs":"","hd":"","iv_load_policy":"","loop":"","modestbranding":1,"origin":"","playerapiid":"","playlist":"","rel":0,"showinfo":0,"showsearch":"","start":"","theme":"","version":3,"wmode":"opaque"}
                                  });
                              }
  
                              if(window.YT){
                                  onYouTubeIframeAPIReady();
                              }
                          &lt;/script&gt;
  </code></pre>