以编程方式将谷歌浏览器与JavaScript全屏模式? [英] Programmatically put Google Chrome into full-screen mode with Javascript?
问题描述
我最近在YouTube上点击YouTube视频的全屏按钮时,屏幕顶部出现一条消息,说我已进入全屏模式。此消息是您在键盘上按f-11时获得的本机消息。我还在某处阅读了某些内容(我现在无法找到),并说现在可以使用Javascript进行此操作。
我如何将用户浏览器(谷歌浏览器)置于全屏,命令? - 没有扩展名,他们需要下载之前,或任何此类性质。
我使用jQuery,所以这将是最好的,但我找不到完全可以做到。
编辑:我已经看到了这种性质的其他问题,但很久以前他们被问到了,我相信这个功能是相当新的。
这篇文章很好: Native Fullscreen JavaScript API 。它描述了所有三种方法:webkit,firefox和W3提案。
// mozilla提议
element.requestFullScreen( );
document.cancelFullScreen();
// Webkit(适用于Safari和Chrome Canary)
element.webkitRequestFullScreen();
document.webkitCancelFullScreen();
// Firefox(夜间工作)
element.mozRequestFullScreen();
document.mozCancelFullScreen();
// W3C提案
element.requestFullscreen();
document.exitFullscreen();
I was on youtube recently when I clicked the fullscreen button by the youtube video and a message appeared at the top of the screen saying that I was put into full-screen mode. This message was the native message you get when pressing f-11 on your keyboard. I also read something somewhere(that I now cannot find) saying that it's now possible to do this with Javascript.
Question
How would I put the users browser(Google Chrome) into fullscreen, on command? - without an extension they would need to download prior, or anything of that nature.
I'm using jQuery so that would be best, but I can't find how to do it at all.
EDIT: I've seen other questions of this nature, but they were asked a long time ago, and I believe this functionality is fairly new.
Here is good article: Native Fullscreen JavaScript API . It describes all three methods: webkit, firefox and W3-proposal.
// mozilla proposal
element.requestFullScreen();
document.cancelFullScreen();
// Webkit (works in Safari and Chrome Canary)
element.webkitRequestFullScreen();
document.webkitCancelFullScreen();
// Firefox (works in nightly)
element.mozRequestFullScreen();
document.mozCancelFullScreen();
// W3C Proposal
element.requestFullscreen();
document.exitFullscreen();
这篇关于以编程方式将谷歌浏览器与JavaScript全屏模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!