<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta content="telephone=no" name="format-detection" />
<title>测试</title>
</head>
<body>
<a id="test" href="#">全屏</a>
<script>
function launchFullScreen(element) {
if(element.requestFullScreen) {
element.requestFullScreen();
} else if(element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if(element.webkitRequestFullScreen) {
element.webkitRequestFullScreen();
}
}
document.getElementById("test").onclick = function(){
launchFullScreen(document.documentElement);
}
// 在支持的浏览器中启动全屏
//launchFullScreen(document.documentElement); // 整个页面
//launchFullScreen(document.getElementById("videoElement")); // 单个元素
</script>
</body>
</html>