Skip to content

Instantly share code, notes, and snippets.

@jorgeortega
Created April 30, 2019 12:24
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jorgeortega/59ec45e572ef247ace57bbdf3600faec to your computer and use it in GitHub Desktop.
Save jorgeortega/59ec45e572ef247ace57bbdf3600faec to your computer and use it in GitHub Desktop.
Check if window is fullscreen, maximized or not maximized
const isAtMaxWidth = screen.availWidth - window.innerWidth === 0
const screenPixelRatio = (window.outerWidth - 8) / window.innerWidth
const isAtDefaultZoom = screenPixelRatio > 0.92 && screenPixelRatio <= 1.10
const isMaximizedAndDefaultZoom = isAtMaxWidth && isAtDefaultZoom
const isFullscreen = window.outerWidth == screen.width && window.outerHeight == screen.height
@Zibri
Copy link

Zibri commented Nov 16, 2022

isFullScreen=window.matchMedia('(display-mode: fullscreen)').matches;
isOnHomepage=isFullScreen=window.matchMedia('(display-mode: standalone)').matches;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment