V jednotlivých prohlížečích se informace o aktuální velikosti okna zjišťuje dost různě, je tedy nutno použít určitou kaskádu pro „univerzální“ (alespoň trochu) vyhodnocení:
var winWidth, winHeight, d=document;
if (typeof window.innerWidth!='undefined')
{
winWidth = window.innerWidth;
winHeight = window.innerHeight;
}
else
{
if (d.documentElement && )typeof d.documentElement.clientWidth != 'undefined') && (d.documentElement.clientWidth != 0))
{
winWidth = d.documentElement.clientWidth;
winHeight = d.documentElement.clientHeight;
}
else
{
if (d.body && (typeof d.body.clientWidth != 'undefined'))
{
winWidth = d.body.clientWidth;
winHeight = d.body.clientHeight;
}
}
}