Javascript full screen code and JS full screen code
// Judge various browsers and find the correct method function launchFullscreen (element) {if (element. requestFullscreen) {element. requestFullscreen ();} else if (element. required requestfullscreen) {element. required requestfullscreen ();} else if (element. webkitRequestFullscreen) {element. webkitRequestFullscreen ();} else if (element. msRequestFullscreen) {element. msRequestFullscreen ();}}
// Enable full screen! LaunchFullScreen(document.doc umentElement); // launchFullScreen (document. getElementById ("videoElement"); // a page Element
Exit full screen
// Determine the browser type function exitFullscreen () {if (document. exitFullscreen) {document. exitFullscreen ();} else if (document. mozCancelFullScreen) {document. canccancelfullscreen ();} else if (document. webkitExitFullscreen) {document. webkitExitFullscreen () ;}// exit full screen mode! ExitFullscreen ();
Method 2:
var opt='top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no'; window.open(youurl, "", opt);
I really want to teach JavaScript code to make the current webpage full screen!
<! Doctype html> This is a relatively early full-screen code. Now there is pure full-screen API, but the browser compatibility is very poor. It only supports the latest versions of chrome and firefox, And none of others support it, so use this.
The above code has been fixed, and will automatically enter the full screen mode after opening. Of course, you must allow the page to automatically pop up the window.
How can I use js Code to implement full screen F11 on the keyboard? I 'd better try it and give the answer
<Html>
<Head>
<Title> test </title>
<Script language = "JavaScript">
Function Fkey (){
Var WsShell = new ActiveXObject ('wscript. shell ')
WsShell. SendKeys ('{F11 }');
}
</Script>
</Head>
<Body>
<A href = "javascript: Fkey ()"> screen switching </a>
</Body>
</Html>