嵌入式Youtube iFrame全屏按钮不工作

Embedded Youtube iFrame FullScreen button is not working

本文关键字:按钮 工作 Youtube iFrame 嵌入式      更新时间:2023-09-26

我使用Youtube推荐的方法嵌入了代码,但全屏功能根本不起作用。所以我尝试添加mozallowfullscreen、webkitallowfullscreen等,但仍然没有成功。

<iframe src="http://www.youtube.com/v/16N8Zhhhins?rel=0&hl=en&fs=1&autoplay=1" frameborder="0" width="100%" height="100%" id="listing_detail_youtube" mozallowfullscreen webkitallowfullscreen allowfullscreen="1"></iframe>

万一有用的话。。开始时的doctype等是:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" style="overflow-x: hidden">
<head>

iFrame上的CSS,如果有帮助的话。。。

#listing_detail_youtube {
    width:100%;
    height:100%;
    margin:0px;
    padding:0px;
}

但是。当我单独复制粘贴视频iframe URL并在Firefox、Chrome等上打开它时,全屏仍然无法工作,所以我怀疑问题在<iframe>标签中。

<iframe src="https://www.youtube.com/embed/1gI_HGDgG7c" allowfullscreen="" height="315" width="460"></iframe>

使用https://www.youtube.com/embed/-video_id-

我刚刚通过使用html5的新嵌入命令而不是iframes解决了这个问题。例如,请查看此页面:

http://www.flexxifinger.com/videoemb.php

希望这能帮助。。。