Return to Snippet

Revision: 25609
at April 2, 2010 08:47 by djstaz0ne


Initial Code
function getWindowSize(){
	var x = 0;
	var y = 0;
	if (self.innerHeight)
	{
		x = self.innerWidth;
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
	{
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body)
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
	return {"x":x,"y":y};
}

Initial URL
http://perpetualtechnologies.net

Initial Description
Returns window size as object.
winsize.x = window width;
winsize.y = window height;

Initial Title
Get Window Height and Width (Cross-Compatible)

Initial Tags
javascript, ie, window

Initial Language
JavaScript