How do I get the size of the browser window using Prototype.js?

DaveC picture DaveC · May 7, 2009 · Viewed 15.7k times · Source

How do I get the size of the browser window using Prototype.js version 1.6.0.3?

Answer

PatrikAkerstrand picture PatrikAkerstrand · May 7, 2009

According to the Prototype API documentation:

var viewport = document.viewport.getDimensions(); // Gets the viewport as an object literal
var width = viewport.width; // Usable window width
var height = viewport.height; // Usable window height