Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect fullscreen mode

Modern desktop version of IE 10 is always fullscreen.

There is a living specification for :fullscreen pseudo-class on W3

But when I tried to detect fullscreen with jQuery version 1.9.x and 2.x:

$(document).is(":fullscreen")  

it threw this error:

Syntax error, unrecognized expression: fullscreen

Questions:

  1. Is it because jQuery doesn't recognize this standard yet or IE10?

  2. What is the legacy way of checking fullscreen mode? I am expecting following results:

    function IsFullScreen() {      /* Retrun TRUE */      /* If UA exists in classic desktop and not in full screen  */      /* Else return FALSE */ } 
  3. Can we do it without browser sniffing?

like image 487
Annie Avatar asked May 26 '13 00:05

Annie


People also ask

How do I tell if an element is fullscreen?

Tip: Use the element. requestFullscreen() method to view an element in fullscreen mode. Tip: Use the element. exitFullscreen() method to cancel fullscreen mode.

How do I get my screen out of fullscreen mode?

The most common way to get out of full screen mode on Windows 10 is to use the 11th function key. To leave full screen mode on Windows 10, press F11 located near the top-right of your keyboard. You can press F11 again to return.

How do I search full screen mode?

First way: F11 - To get out of full screen mode temporarily. F6 - Shortcut key to URL bar. Enter URL and press enter. F11 - Get back to full screen mode.

What is fullscreen mode?

Full screen mode allows you to watch videos that take up your entire screen. Android ComputeriPhone & iPad. More. More.


1 Answers

As you have discovered, browser compatibility is a big drawback. After all, this is something very new.

However, since you're working in JavaScript, you have far more options available to you than if you were just using CSS.

For example:

if( window.innerHeight == screen.height) {     // browser is fullscreen } 

You can also check for some slightly more loose comparisons:

if( (screen.availHeight || screen.height-30) <= window.innerHeight) {     // browser is almost certainly fullscreen } 
like image 72
Niet the Dark Absol Avatar answered Sep 29 '22 12:09

Niet the Dark Absol