Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3718

CORS error when accessing an embedded YouTube Player API in iframe [duplicate]

$
0
0

I'm trying to access the YouTube Player API from my web page to programmatically control an embedded YouTube video in an iframe. When I try to execute this code player = iframe.contentWindow.player;, I'm encountering a CORS (Cross-Origin Resource Sharing) error that prevents the API requests from being executed. Here are the details:

I have already set the origin parameter in the API request URL to match my website's origin (https://example.com). However, it seems that the YouTube player API still enforces the same-origin policy and blocks the requests.Is there any way to overcome this CORS error and access the YouTube Player API from a different origin? Am I missing something in the configuration or is there an alternative solution I should consider?

Any help or guidance would be greatly appreciated. Thank you!


Viewing all articles
Browse latest Browse all 3718

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>