Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('<URL>') does not match the recipient window's origin ('<URL>')

不问归期 提交于 2020-02-07 03:57:44

问题


I'm getting this error: Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('<URL>') does not match the recipient window's origin ('<URL>').

My page operates as I'd hoped (I don't notice any unwanted behavior), but I never like ignoring errors in my console, especially if I don't even understand the root cause.

My question is NOT A DUPLICATE because I've already studied all of these questions but none of the answers worked:

  • Failed to execute 'postMessage' on 'DOMWindow': https://www.youtube.com !== http://localhost:9000
  • Failed to execute 'postMessage' on 'DOMWindow': The target origin provided does not match the recipient window's origin ('null')
  • Youtube API - Failed to execute 'postMessage' on 'DOMWindow'
  • YouTube API and cross origin requests
  • YouTube iFrame Player API failed to execute postMessage on DOMWindow
  • Failed to execute 'postMessage' on 'DOMWindow': target/origin mismatch http vs https

I'm already using https.

I've already tried setting playerVars to {origin: window.location.origin}.

I've already tried setting host.

I've already tried changing the visibility of the iframe.

And so on.

var playerVars = {origin: window.location.origin};//https://stackoverflow.com/a/50518247/470749
window.onYouTubeIframeAPIReady = function () {
    for (var i = 0; i < youtube.length; i++) {
        var youtubeLazyEl = youtube[i];
        var videoId = youtubeLazyEl.dataset.v;
        players[videoId] = new YT.Player(videoId, {
            videoId: videoId,
            //host: 'https://www.youtube.com', //https://stackoverflow.com/a/47914456/470749
            //playerVars: playerVars,
        });
    }
};

Ideas?

来源:https://stackoverflow.com/questions/57649870/failed-to-execute-postmessage-on-domwindow-the-target-origin-provided-ur

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!