Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting if a browser is in full screen mode

Is there any way of reliably detecting if a browser is running in full screen mode? I'm pretty sure there isn't any browser API I can query, but has anyone worked it out by inspecting and comparing certain height/width measurements exposed by the DOM? Even if it only works for certain browsers I'm interested in hearing about it.

like image 770
Simon Lieschke Avatar asked Jun 26 '09 04:06

Simon Lieschke


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 make sure Chrome is full screen?

The quickest way to get Chrome in full-screen mode in Windows is to press F11 on the keyboard. The other way is through the Chrome menu: In the upper-right corner of Chrome, select the menu (three-dot) icon. In the Zoom section, select the square icon on the right.

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.

Are browsers fullscreen?

On a Windows computer, you can set Google Chrome, Internet Explorer, Microsoft Edge, or Mozilla Firefox to full-screen mode, hiding the toolbars and address bar by pressing the F11 key. To reverse this action and show these items again, press F11 again.


2 Answers

Chrome 15, Firefox 10, and Safari 5.1 now provide APIs to programmatically trigger fullscreen mode. Fullscreen mode triggered this way provides events to detect fullscreen changes and CSS pseudo-classes for styling fullscreen elements.

See this hacks.mozilla.org blog post for details.

like image 145
Simon Lieschke Avatar answered Sep 25 '22 08:09

Simon Lieschke


What about determining the distance between the viewport width and the resolution width and likewise for height. If it is a small amount of pixels (especially for height) it may be at fullscreen.

However, this will never be reliable.

like image 28
alex Avatar answered Sep 25 '22 08:09

alex