Which is the event when the browser window is resized in JavaScript?

HTMLJavascriptProgramming Scripts

Use window.outerWidth and window.outerHeight event in JavaScript to get the size of windows when the browser is resized.


You can try to run the following code to work with events to check the browser window size −

<!DOCTYPE html>
         function resizeFunction() {
            var val = "Window Width=" + window.outerWidth + ", Window Height="
            + window.outerHeight;
            document.getElementById("test").innerHTML = val;
   <body onresize = "resizeFunction()">
      <p>Resize browser window and check the window (browser window)
      height and width again.</p>
      <p id = "test"> </p>
Published on 26-Feb-2018 13:10:37