Javascript – Get the size of the screen, current web page and browser window


How can I get windowWidth, windowHeight, pageWidth, pageHeight, screenWidth, screenHeight, pageX, pageY, screenX, screenY which will work in all major browsers?

screenshot describing which values are wanted

Best Solution

You can get the size of the window or document with jQuery:

// Size of browser viewport.

// Size of HTML document (same as pageHeight/pageWidth in screenshot).

For screen size you can use the screen object: