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/470749window.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?