Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Nov 2005
    Posts
    85
    Thanks
    22
    Thanked 0 Times in 0 Posts

    How to detect fullscreen in IE11 using document.msFullscreenElement !== null

    I am trying to detect if a page is in fullscreen mode in IE11:

    Code:
    <!DOCTYPE html>
    <head>
    <title>Detect Fullscreen</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript">
    var inFullscreen = document.msFullscreenElement !== null; 
    alert("inFullscreen is " + inFullscreen);
    </script>
    </head>
    <body>
    <p>Detect Fullscreen in IE11</p>
    </body>
    </html>
    I wanted to do it this way (rather the comparing inner or outer height/width to screen height/width), however, the outcome of the alert is false whether or not the browser is in fullscreen. Presumably I misunderstand how document.msFullscreenElement is meant to be applied?

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,901
    Thanks
    79
    Thanked 4,421 Times in 4,386 Posts
    Philip: When I find a crosspost like this, especially if there are other crossposts, I bump the poster's reputation DOWN by one.

    Of course, you may not feel as strongly about crossposting as I do. <grin/>
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #4
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,372
    Thanks
    11
    Thanked 591 Times in 572 Posts
    var inFullscreen = !! document.msFullscreenElement;
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.6, IE11:9.1, IE9:3.1, IE10:3.0, FF:17.2, CH:46, SF:11.4, NON-MOUSE:38%

  • #5
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    OP - your hit power is much more than one - I would guess 50 at least, so you push them down to "can only improve".
    Personally, I would not give cross-posters negative rep. Boiling in oil would be quite sufficient.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •