Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我可以使用jquery点击YouTube iframe吗?_Jquery_Youtube - Fatal编程技术网

我可以使用jquery点击YouTube 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示例:

<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();