Đối với Chrome qua Chrome Fullscreen API
Lưu ý rằng vì lý do an ninh (Chrome) nó không thể được gọi hay thực hiện tự động thì phải có sự tương tác từ người sử dụng đầu tiên. (Chẳng hạn như nút bấm, KeyDown/bấm phím, vv)
addEventListener("click", function() {
var
el = document.documentElement
, rfs =
el.requestFullScreen
|| el.webkitRequestFullScreen
|| el.mozRequestFullScreen
;
rfs.call(el);
});
Javascript Fullscreen API như demo 'd bởi David Walsh điều đó dường như là một giải pháp trình duyệt chéo
// Find the right method, call on correct element
function launchFullScreen(element) {
if(element.requestFullScreen) {
element.requestFullScreen();
} else if(element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if(element.webkitRequestFullScreen) {
element.webkitRequestFullScreen();
}
}
// Launch fullscreen for browsers that support it!
launchFullScreen(document.documentElement); // the whole page
launchFullScreen(document.getElementById("videoElement")); // any individual element
có thể trùng lặp của [Có cách nào để tạo video toàn màn hình HTML5 không?] (Http://stackoverflow.com/questions/1055214/is-there-a-way-to-make-html5-video-fullscreen). Mặc dù bản thân câu hỏi của tôi không trùng lặp với câu hỏi này, câu trả lời được chấp nhận cũng sẽ trùng khớp ở đây. Trong mọi trường hợp, hãy xem [API toàn màn hình HTML5] (http://www.sitepoint.com/html5-full-screen-api/) – feeela
Tìm thấy câu hỏi tương tự [http://stackoverflow.com/questions/7495373/làm thế nào để làm cho trình duyệt toàn màn hình-sử dụng-f11-key-sự kiện-thông qua-javascript] – Mozak
có thể trùng lặp của [Chuyển cửa sổ giữa chế độ bình thường và chế độ toàn màn hình] (http://stackoverflow.com/questions/11436376/switch-window-between-normal-and-full-screen-mode) – JJJ