This is the error message that I get:
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided
('https://www.youtube.com') does not match the recipient window's origin
('http://localhost:9000').
I've seen other similar problems where the target origin is http://www.youtube.com
and the recipient origin is https://www.youtube.com
, but none like mine where the target is https://www.youtube.com
and the origin is http://localhost:9000
.
- I don't get the problem. What is the problem?
- How can I fix it?
I believe this is an issue with the target origin being
https
. I suspect it is because your iFrame url is usinghttp
instead ofhttps
. Try changing the url of the file you are trying to embed to behttps
.For instance:
to be:
I think the description of the error is misleading and has originally to do with wrong usage of the player object.
I had the same issue when switching to new Videos in a Slider.
When simply using the
player.destroy()
function described here the problem is gone.You can save into local files:
Into first file, player_api put this code:
Into second, find some like: this.a.contentWindow.postMessage(a,b[c]);
and change to:
Of course, u can concatenate into one file - will be more efficient. This is not perfect solution, but it's works!
My Source : yt_api-concat
PS: Sorry, english is not my first languge.
Just add the parameter
"origin"
with the URL of your site in theparamVars
attribute of the player, like this:I got the same error. My mistake was that the
enablejsapi=1
parameter was not present in theiframe
src.Try using
window.location.href
for the url to match the window's origin.