When I'm trying to access to iframe getElementById('video');
it returns undefined and I have tried many methods of accessing to iframe content but nothing works. I want change the playlist styles.
Pls help!!!!
Asked
Active
Viewed 22 times
0

user9349544
- 11
- 1
-
Possible duplicate of [jQuery/JavaScript: accessing contents of an iframe](https://stackoverflow.com/questions/364952/jquery-javascript-accessing-contents-of-an-iframe) – John Ellmore Aug 20 '18 at 21:15
-
1If you need to exercise basic control over the player, try using the [YouTube Player API](https://developers.google.com/youtube/iframe_api_reference). – John Ellmore Aug 20 '18 at 21:16
-
For more help, please post what you're trying to do, not just the problem. – Chris Happy Aug 20 '18 at 21:24
1 Answers
0
Unfortunately, you can't edit the HTML of an iframe that comes from a different domain.
This comes from the cross-domain policy. More info.
If you still want to do it, you have to be able to run scripts on iframe
page, which is not possible for YouTube. (AFAIK) Edit: Didn't know about the YouTube Player API as mentioned by John Ellmore.

Chris Happy
- 7,088
- 2
- 22
- 49