bhylu.com

Advertisements

JS Window

Window is the browser page global object. Browser APIs differ from the global objects available in a worker or server runtime.

Where to run this

Use a local browser project for this example. It needs browser permissions, additional files, a server endpoint, or a library as described below. The restricted playground cannot provide those dependencies.

A practical example

JavaScript

console.log(window.innerWidth);
console.log(window.innerHeight);

What happens

A local page console reports the viewport dimensions.