IE browser-compatible JS browser full-screen code

Source: Internet
Author: User

As we all know, ie is a wonderful browser, but due to the large number of users, developers still have to consider for IE, so, a variety of browser-related operations, there is a special judgment-specifically for IE browser judgment, the full screen here is no exception. Look at the code:

functionfullscreen () {varEl =document.documentelement; varRFS = El.requestfullscreen | | El.webkitrequestfullscreen | |El.mozrequestfullscreen||El.msrequestfullscreen; if(typeofRFS! = "undefined" &&RFS)  {Rfs.call (EL); } Else if(typeofWindow. ActiveXObject! = "undefined") {    //For IE, this is actually simulating the F11 of pressing the keyboard, making the browser full screen    varwscript =NewActiveXObject ("Wscript.Shell"); if(WScript! =NULL) {WScript. SendKeys ("{F11}"); }  }}

Here is a simple example (assuming the above code is saved in the Script.js file): This function is called in the button:

IE browser-compatible JS browser full-screen code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.