YouTube的Iframe没有全屏按钮 [英] Youtube Iframe no fullscreen button

查看:421
本文介绍了YouTube的Iframe没有全屏按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许这是星期五下午踢,但由于某种原因,我似乎无法得到一个全屏按钮出现在我的嵌入式Youtube视频。我所做的只是复制从Youtube视频生成的共享代码:

 < iframe width =560 height =315src =http://www.youtube.com/embed/hFoQVx8ZcHo?rel=0frameborder =0allowfullscreen>< / iframe> 

例如,使用此代码。


Maybe it's Friday afternoon kicking in but for some reason I seem unable to get a fullscreen button to appear on my embedded Youtube videos. All I'm doing is copying the share code which is generated from a Youtube video:

<iframe width="560" height="315" src="http://www.youtube.com/embed/hFoQVx8ZcHo?rel=0" frameborder="0" allowfullscreen></iframe>

So for example with this code http://jsfiddle.net/chricholson/v8sjL/ I see:

I found some articles which said about the URL being wrong /v/[code] rather than /embed/[code] but copying directly from Youtube I thought I'd be safe.

解决方案

It seems I needed a number of changes, final code:

<iframe width="560" height="315" src="http://www.youtube.com/embed/hFoQVx8ZcHo?rel=0&fs=1" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>​

Firstly, the URL needs &fs=1, this triggers the button to show. Additionally, webkitallowfullscreen and mozallowfullscreen are needed, stating the obvious these solve browser specific problems.

One interesting thing I did find, despite having the working code, this sample DOES NOT work through jsfiddle, presumably something to do with being inside of an iframe. See http://jsfiddle.net/mrchris2013/v8sjL/5/ for what I mean.

这篇关于YouTube的Iframe没有全屏按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆