I have:
window.addEventListener('resize',doSomething,false);
function doSomething() {
var yres = document.body.offsetHeight;
var xres = document.body.offsetWidth;
alert(xres+'x'+yres);
}
This function shows my body resolution in google chrome my (1350×651), in firefox (1509×20) and in internet explorer (nothing). Why are the resolution from different browser different?
thanks.
With jQuery it’s simple, do something like:
Without js this should suffice:
In your case im guessing you would use window since that’s where you added the listener. Also, http://www.javascripter.net/faq/browserw.htm could help with some more foolproof code since offsetWidth and Height seems to be some IE thing.