The target origin provided does not match the reci

2019-06-26 05:40发布

问题:

The complete error is "Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://www.youtube.com') does not match the recipient window's origin ('http://localhost:8100').", this is what im doing in index.html file, the audio is coming but video is not.

  <script>
  var tag = document.createElement('script');
  tag.src = "https://www.youtube.com/iframe_api";
  var firstScriptTag = document.getElementsByTagName('script')[0];
  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

  // Replace the 'ytplayer' element with an <iframe> and
  // YouTube player after the API code downloads.
  var player;
  function onYouTubePlayerAPIReady() {
  player = new YT.Player('ytplayer', {
  height: '390',
  width: '640',
  videoId: 'jdqsiFw74Jk'
  });
  }
  </script>

Also i want to send video id from page to index.html