One, into full screen
Judge various browsers and find the correct method
function Launchfullscreen (element) {
if (element.requestfullscreen) {
Element.requestfullscreen ();
} else if (element.mozrequestfullscreen) {
element.mozrequestfullscreen ();
} else if ( Element.webkitrequestfullscreen) {
element.webkitrequestfullscreen ();
} else if ( Element.msrequestfullscreen) {
element.msrequestfullscreen ();
}
}
Start Full screen!
Launchfullscreen (document.documentelement); Entire page
Launchfullscreen (document.getElementById ("videoelement"));//a page element
Two, exit full screen
Determine browser kind
function Exitfullscreen () {
if (document.exitfullscreen) {
document.exitfullscreen ();
} else if (document.mozcancelfullscreen) {
document.mozcancelfullscreen ();
} else if ( Document.webkitexitfullscreen) {
document.webkitexitfullscreen ();
}
}
Exit Full-screen Mode!
Exitfullscreen ();
Three, simplified demo
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >