Back to Content

Window: viewport property

files/en-us/web/api/window/viewport/index.md

latest1.0 KB
Original Source

{{APIRef("Viewport Segments API")}}{{SeeCompatTable}}

The viewport read-only property of the {{domxref("Window")}} interface returns a {{domxref("Viewport")}} object instance, which provides information about the current state of the device's viewport.

See the {{domxref("Viewport")}} API for all available properties.

Value

A {{domxref("Viewport")}} object instance.

Examples

Basic viewport usage

js
const currentViewport = window.viewport;
const segments = window.viewport.segments;

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also