Window: viewport property

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

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

undefined

Basic viewport usage

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

Specifications

See also