I want to get live screen resolution of web browser as user RESTORE DOWN OR MAXIMIZE without refreshing the page.
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.
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
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With