How to get screen resolution in real time

I want to get a real-time screen resolution of a web browser as a RESTORE DOWN OR MAXIMIZE user without refreshing the page.

+7
source share
2 answers

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 }); 
+10
source

Not quite sure what you are after, but here are some tips.

window.screen contains the current OS resolution. This is available through screen.height and screen.width . Two other interesting values ​​might be availHeight and availWidth (not 100% sure cross-browser availability)

If you need to know the current browser sizes that are stored in the window object itself. window.innerHeight , window.outerHeight , window.innerWidth and window.outerWidth are the values ​​of interest. Internal prefix values ​​reflect the working (client) area of ​​the browser, while external prefixes contain the entire area of ​​the browser window.

+7
source

All Articles