Window.screen

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Retourne une référence à l'objet screen associé à la fenêtre. L'object screen, qui implémente l'interface Screen, est un objet spécial servant à examiner les propriétés de l'écran qui affiche la fenêtre courante.

Syntaxe

js
objetEcran = window.screen;

Examples

js
if (screen.pixelDepth < 8) {
  // utiliser la page en colorisation réduite
} else {
  // utiliser la page en coolorisation normale
}

Spécifications

Specification
CSSOM View Module
# dom-window-screen

Compatibilité des navigateurs

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
screen

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support