question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to execute 'postMessage' on 'DOMWindow'

See original GitHub issue

I last worked on my project about a month ago. At that time, I was able to get Youtube videos to load and play properly in react-player. After coming back, I’ve discovered that something seems to have changed and now the video won’t load. I end with the following error:

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://www.youtube.com') does not match the recipient window's origin ('http://localhost:8000').

I’ve looked up some StackOverflow questions about it and I’ve read that it’s an error coming from the Youtube iFrame API when you make a request for a Youtube video over http instead of https. I put some logging in the react-player library and saw that the requests are supposedly being made over https, so I don’t think that’s the issue I’m having here.

Does anyone have any insight into this?

As an aside, I’m using Gatsby as my platform. Not sure if this really matters.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:17
  • Comments:25 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
cookpetecommented, Jan 15, 2019

I’m aware of the issue, but afaik it’s a problem with with the Youtube iFrame API based on whatever URL you are calling the API from, and it’s not very consistent. This issue should remain closed unless there is a specific problem that ReactPlayer is causing.

There are plenty of mentions of the error elsewhere: https://www.google.com/search?q=youtube+iframe+Failed+to+execute+'postMessage'+on+'DOMWindow'%3A

However, ReactPlayer already tries to implement the solutions posted, eg adding the origin property to the playerVars. Also note this commit that pinned the API URL to https to try and prevent this issue.

If the error is still occurring (and not consistently) then I’m not sure what else can be done in this library.

5reactions
NathanielHillcommented, Oct 29, 2018

I’m getting the same warning although the videos work, did you resolve it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to execute 'postMessage' on 'DOMWindow': https://www ...
I believe this is an issue with the target origin being https . I suspect it is because your iFrame url is using...
Read more >
Failed to execute 'postMessage' on 'DOMWindow ... - GitHub
Hi David, I face an issue when using your scripts in sharepoint sites. Failed to execute 'postMessage' on 'DOMWindow': The target origin (https://....
Read more >
Failed to execute 'postMessage' on 'DOMWindow'
Youtube player widget, out of nowhere, started to show errors in browser console. www-widgetapi.js:758 Failed to execute 'postMessage' on 'DOMWindow': The ...
Read more >
Failed to execute 'postMessage' on 'DOMWindow': The target ...
Currently, I'm facing an issue. Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://companyName--c.visualforce.
Read more >
Solved: Re: Failed to execute 'postMessage' on 'DOMWindow'
I get this error: Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://service.mydomain.com') does not match the recipient ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found