0

I have the following iframe example:

<iframe class="iframe-test" id="video" width="560" height="315" src="https://www.youtube.com/embed/iRYDYrj3Bfw" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

I have tried the following but nothing is happening:

$('#video').click();

Does it have something to do with cross-domain iframes?

BrokenCode
  • 951
  • 4
  • 19
  • 43
  • If autoplay is what you want to achieve try to follow this https://stackoverflow.com/questions/7281765/youtube-iframe-embed-auto-play – Luxato Nov 05 '18 at 10:39

1 Answers1

1

You can't get DOM elements from a different domain site opened by iframe. Your code would work if you open a site that has the same domain as the origin.

Brank Victoria
  • 1,447
  • 10
  • 17