MDN self-hosted library · e01.org

Window: viewport property

Viewport Segments API

Open notebook · 1 cells web-api-instance-property upstream source

Viewport Segments API

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

See the Viewport API for all available properties.

Value

A Viewport object instance.

Examples

Basic viewport usage

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

Specifications

Browser compatibility

See also