如何使用JavaScript以一种适用于IE,Firefox和Opera的方式使访问者的浏览器全屏显示?
我正在为即将推出的Chrome网上商店创建一个网络应用.有没有办法模拟F11被按下?或者只是一个命令,使当前窗口全屏显示?
我如何模拟F11(全屏不是最大化浏览器窗口)与flash一样:http://www.broculos.net/files/articles/FullscreenFlash/flashFullscreen.html ?
在flash中: fscommand("fullscreen", true )
permadi.com/tutorial/flash9FullScreen/index.html
Run Code Online (Sandbox Code Playgroud)
谢谢
更新
我找到了这个:
var docElm = document.documentElement;
if (docElm.requestFullscreen) {
docElm.requestFullscreen();
} else if (docElm.mozRequestFullScreen) {
docElm.mozRequestFullScreen();
} else if (docElm.webkitRequestFullScreen) {
docElm.webkitRequestFullScreen();
}
/* Exiting the full screen => showing the FULL SCREEN button */
if (docElm.requestFullscreen) {
document.addEventListener("fullscreenchange", function () {
if(!document.fullscreen) {
// Do something
}
}, false);
} else if (docElm.mozRequestFullScreen) {
document.addEventListener("mozfullscreenchange", function () {
if(!document.mozFullScreen) {
// Do something
}
}, false);
} …Run Code Online (Sandbox Code Playgroud)