在我的脚本中,我点击了按钮点击全屏显示,但我需要在没有任何用户交互的情况下最初以全屏显示页面。
function requestFullScreen(element) {
// Supports most browsers and their versions.
var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullscreen;
if (requestMethod) { // Native full screen.
requestMethod.call(element);
} else if (typeof window.ActiveXObject !== "undefined") { // Older IE.
var wscript = new ActiveXObject("WScript.Shell");
if (wscript !== null) {
wscript.SendKeys("{F11}");
}
}
}
var element = document.body; // Make the body go full screen.
requestFullScreen(element);

<body>
<input type="button" value="click to toggle fullscreen" onclick="requestFullScreen(element)">
&#13;
答案 0 :(得分:-1)
你只需在下面的框中使用你的全屏代码。当页面被加载时,它将执行你的代码。
$(document).ready(function(){
});