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.

We’d love to hear your thoughts on the next set of proposals for the JavaScript language. You can find a description of the proposals here.
Please take two minutes to fill out our short survey.

Windowscreen プロパティは、ウィンドウに関連付けられた画面オブジェクトへの参照を返します。 screen オブジェクトは Screen インターフェイスを実装しており、現在のウィンドウがレンダリングされている画面のプロパティを検査するための特別なオブジェクトです。

構文

let screenObj = window.screen;

js
if (screen.pixelDepth < 8) {
  // use low-color version of page
} else {
  // use regular, colorful page
}

仕様書

Specification
CSSOM View Module
# dom-window-screen

ブラウザーの互換性