I want to get live screen resolution of web browser as user RESTORE DOWN OR MAXIMIZE without refreshing the page.
Asked
Active
Viewed 1.9k times
11
-
Are you using java script on client side? More specifically jQuery? – Amar Palsapure Jan 09 '12 at 11:39
-
Does [this](http://andylangton.co.uk/articles/javascript/browser-screen-resolution/) solution work for you? – Different55 Jan 09 '12 at 11:40
-
http://stackoverflow.com/questions/641857/javascript-window-resize-event – Bojan Dević Jan 09 '12 at 11:47
-
how many monitors are you using? – Bekim Bacaj Feb 10 '17 at 00:51
2 Answers
14
Are you using jQuery? If yes, then the code below should work
$(window).resize(function(){
var windowWidth = $(window).width();
var windowHeight = $(window).height();
// windowWidth & windowHeight are automatically updated when the browser size is modified
});

Karthik Rao
- 321
- 3
- 9
12
Not entirely sure what you're after, but here are some suggestions.
window.screen
contains the current OS resolution. That is accessible via screen.height
and screen.width
. Two other interesting values might be availHeight
and availWidth
(not 100% sure about the cross-browser availabilty there)
If you need to know the current browser-dimensions, that is stored on the window
object itself. window.innerHeight
, window.outerHeight
, window.innerWidth
and window.outerWidth
are the values of interest there. The inner prefixed values do reflect the working(client) area of the browser, whereas the outer prefixes contain the whole browser window area.

jAndy
- 231,737
- 57
- 305
- 359