1

In javascript, Is there a way to know if the navigator is fullscreen ? I mean real fullscreen (F11 with chrome).

I need to propose it to the user only if he hasn't done it yet.

Muath
  • 4,351
  • 12
  • 42
  • 69
Nicolas
  • 1,812
  • 3
  • 19
  • 43
  • `if (window.innerHeight == screen.height)` comes to mind, but it's probably not very accurate – adeneo Jan 14 '14 at 16:17
  • 1
    http://stackoverflow.com/questions/21103478/fullscreenchange-event-not-firing-in-chrome – Reactgular Jan 14 '14 at 16:19
  • There's no native API to check if the navigator is in fullscreen mode ... but you have the fullscreenEnabled method that return true if the context object and all ancestor browsing context's documents have their fullscreen enabled flag set ... if it returns false there must be an element in FS mode (or not?). https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#api https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode – rafaelcastrocouto Jan 14 '14 at 16:24
  • you can use css to hide the button in non-fullscreen: https://developer.mozilla.org/en-US/docs/Web/CSS/:fullscreen – dandavis Jan 14 '14 at 17:20

1 Answers1

-1

For new browsers, this will work

function isFullScreen(){
    return (!window.screenTop && !window.screenY) 
}
scrblnrd3
  • 7,228
  • 9
  • 33
  • 64