Chrome全屏API [英] Chrome Fullscreen API
本文介绍了Chrome全屏API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
根据这篇文章 Google Chrome 15有一个全屏JavaScript API。
According to this article Google Chrome 15 has a fullscreen JavaScript API.
我试图让它工作但失败。我也搜索了官方文档。
I have tried to make it work but failed. I have also searched for official documentation in vain.
全屏JavaScript API是什么样的?
What does the fullscreen JavaScript API look like?
推荐答案
API仅在用户交互过程中起作用,因此不能恶意使用。请尝试以下代码:
The API only works during user interaction, so it cannot be used maliciously. Try the following code:
addEventListener("click", function() {
var el = document.documentElement,
rfs = el.requestFullscreen
|| el.webkitRequestFullScreen
|| el.mozRequestFullScreen
|| el.msRequestFullscreen
;
rfs.call(el);
});
这篇关于Chrome全屏API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文