我可以使用jquery点击YouTube iframe吗?
我有以下iframe示例:我可以使用jquery点击YouTube iframe吗?,jquery,youtube,Jquery,Youtube,我有以下iframe示例: <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></i
<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>
它与跨域iframe有关吗?您无法从iframe打开的其他域站点获取DOM元素。如果您打开一个与源站具有相同域的站点,则代码将起作用。如果您希望实现自动播放,请尝试遵循此操作
$('#video').click();