jQuery:加载时打开/请求全屏浏览器? [英] jQuery: Open/request Fullscreen browser on load?
问题描述
我有一个包含div #container
的页面,我希望在支持的浏览器中进入全屏模式(或至少要求进入全屏模式).
I have a page with a div #container
which I would like to have go into full screen mode (or at least request to go into full screen mode) on supported browsers.
我下载了此插件
,尽管示例全部使用按钮进入全屏显示,但我还是希望在加载时执行此操作.我试过了:
and although the example all show using a button to enter fullscreen, I'd like to do it on load. I tried:
$(window).load(function() {
if($.support.fullscreen){
$('#container').fullScreen();
}
});
它通过了支持测试(Chrome 28),但没有任何反应.我想念什么?
It passes the support test (Chrome 28) but nothing happens. What am I missing?
推荐答案
经过进一步研究,似乎可以仅通过用户交互激活全屏API.出于安全原因.如果有人知道,请随时发布.
It would seem, after further research, that the fullscreen API can only be activated via user interaction for security reasons. If anyone knows otherwise, please feel free to post.
这篇关于jQuery:加载时打开/请求全屏浏览器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!