How to get the size of screen, current web page and browser window using jQuery? Last Updated : 23 Apr, 2019 Comments Improve Suggest changes Like Article Like Report jQuery can be used to get the dimensions of the current page. The dimensions include the screen, viewport and document height, and width. Getting the window dimensions: Window size is the size of the browser window. This is the size that changes when the browser is resized. The windows height and width can be accessed with the height() and width() method after selecting the window object. Getting the document dimensions: Document size is the size of the HTML document. The documents height and width can be accessed with the height() and width() method after selecting the document object. Getting the screen dimensions: Screen size is the total size of the user's screen. The screen's height and width can be accessed with the height and width property. Example: html <!DOCTYPE html> <head> <title> Get the size of the screen, current web page and browser window using jQuery? </title> <script src= "https://code.jquery.com/jquery-2.2.4.min.js"> </script> </head> <body> <h1 style="color: green"> GeeksforGeeks </h1> <b> How to get the size of the screen, current web page and browser window using jQuery? </b> <p>Window Height is: <span class="windowHeight"></span> </p> <p>Windows Width is: <span class="windowWidth"></span> </p> <p>Document Height is: <span class="documentHeight"></span> </p> <p>Document Width is: <span class="documentWidth"></span> </p> <p>Screen Height is: <span class="screenHeight"></span> </p> <p>Screen Width is: <span class="screenWidth"></span> </p> <button id="btn"> Click Here to check the dimensions of the page: </button> <script type="text/javascript"> $("#btn").on("click", function () { windowHeight = $(window).height(); windowWidth = $(window).width(); documentHeight = $(document).height(); documentWidth = $(document).width(); screenHeight = screen.height; screenWidth = screen.width; document.querySelector('.windowHeight').textContent = windowHeight; document.querySelector('.windowWidth').textContent = windowWidth; document.querySelector('.documentHeight').textContent = documentHeight; document.querySelector('.documentWidth').textContent = documentWidth; document.querySelector('.screenHeight').textContent = screenHeight; document.querySelector('.screenWidth').textContent = screenWidth; }); </script> </body> </html> Output: Before clicking the button: After clicking the button: Comment More infoAdvertise with us Next Article How to trigger the window resize event in jQuery ? S sayantanm19 Follow Improve Article Tags : Web Technologies JQuery jQuery-Misc Similar Reads How to make font-size that expands when we resize the window using jQuery ? In this article, we will learn how to increase or decrease the font-size of elements in HTML when the window is resized using jQuery. This can be used in situations where the font size has to be responsive according to the width of the browser window.Approach: We will be using the jQuery css(), widt 2 min read How to detect when the window size is resized using JavaScript ? Sometimes when we develop our site, we want to detect the size of the window, In this article, we are going to learn how to detect when the window size is resized using JavaScriptThe window resize event occurs whenever the size of the browser window gets changed. We can listen to the resize event in 3 min read How to trigger the window resize event in jQuery ? To discuss how to trigger the window resize event using jQuery. For this purpose, we will use the following library functions provided by jQuery.$(<element>).trigger(): This library function allows us to trigger both native and customized events. The method can be used independently or can be 1 min read How to write a browser-specific code using jQuery ? In this article, we will see how to write browser-specific code using jQuery. To write the browser-specific code, we will use the Navigator userAgent property and jQuery indexof() method. The Navigator userAgent property is used to get the user-agent headerâs value sent to the server by the browser. 2 min read Cross-browser window resize event using JavaScript/jQuery The resize() method is an inbuilt method in jQuery that is used when the browser window changes its size. The resize() method triggers the resize event or attaches a function to run when a resize event occurs. jQuery has a built-in method for window resizing events. Syntax: $(selector).resize(functi 2 min read How to get font size of an element using jQuery ? In this article, we will see how to get the font size of an element using jQuery. To get the font size of an element, we will use css() method. The css() method is used to set or return the style property of the selected element. Syntax: var style = $(selector).css(property) Return value: This metho 2 min read Like