Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORS Issues with Youtube Embed #875

Closed
joebentaylor1995 opened this issue May 1, 2020 · 4 comments
Closed

CORS Issues with Youtube Embed #875

joebentaylor1995 opened this issue May 1, 2020 · 4 comments

Comments

@joebentaylor1995
Copy link

joebentaylor1995 commented May 1, 2020

My code:

<ReactPlayer
    url={block.youtubeEmbed}
    className='react-player'
    width='100%'
    height='100%'
/>

block.youtubeEmbed is just pulling the youtube URL

Console 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').

Access to XMLHttpRequest at 'https://googleads.g.doubleclick.net/pagead/id' from origin 'https://www.youtube.com' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

GET https://googleads.g.doubleclick.net/pagead/id net::ERR_FAILED
@joebentaylor1995
Copy link
Author

Ive managed to get rid of the first line error by making sure the video is put in as https:// but the other two I cant figure out

@danihazler
Copy link

I'm getting your same 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:3000').

even if the link is https://

@cookpete
Copy link
Owner

This feels like a duplicate of #508 (comment).

If this is just weirdness with the youtube player API I'm not sure what more this library can do to prevent it.

@danihazler
Copy link

Thanks for your attention! @cookpete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants