本文介绍了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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!