iframe不能全屏

来源:互联网 发布:加权平均图像融合算法 编辑:程序博客网 时间:2024/06/11 19:39

The full screen option, especially over the iframe embed code, can be difficult to get working depending on your site architecture. This is partially why we recommend the JS code.

If you need to use the iframe embed, though, and the full screen button is either missing or not working there are solutions.

The first is to look at your source code to see if you can find any iframes directly above the DaCast embed code. An "iframe within an iframe". Here is an example of this:

 

<iframe name="IFrame_i1cbhqkm" id="IFrame_i1cbhqkm" width="588" height="347" src="http://www.mywebsite.com/html/b32b8d.html">
<html>
<head></head>
<body>
<iframe src="https://iframe.dacast.com/b/888/c/9999" width="576" height="324" frameborder="0" scrolling="no" allowfullscreen="" webkitallowfullscreen="" mozallowfullscreen="" oallowfullscreen="" msallowfullscreen=""></iframe>
</body>
</html>
</iframe>

The issue caused here is that the "parent" iframe is blocking the content from going full screen. So the iframe within, in this case the DaCast player, is also blocked.

The solution is to allow the parent iframe to go full screen. You can do this by adding the following to the code:

allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true" oallowfullscreen="true" msallowfullscreen="true" 

 

Using the above example, here is a version that will work with the full screen option:

<iframe name="IFrame_i1cbhqkm" id="IFrame_i1cbhqkm" width="588" height="347" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true" oallowfullscreen="true" msallowfullscreen="true" src="http://www.mywebsite.com/html/b32b8d.html">
<html>
<head></head>
<body>
<iframe src="https://iframe.dacast.com/b/888/c/9999" width="576" height="324" frameborder="0" scrolling="no" allowfullscreen="" webkitallowfullscreen="" mozallowfullscreen="" oallowfullscreen="" msallowfullscreen=""></iframe>
</body>
</html>
</iframe>

 

0 0
原创粉丝点击