Learn how to get the current screen size/browser window with JavaScript.
Read on how to do it in this tutorial: https://www.w3schools.com/howto/howto_js_get_current_window.asp
Current Screen Size
Use window.innerWidth
and window.innerHeight
to get the current screen size of a page.
This example displays the browser window's height and width (NOT including toolbars/scrollbars).
Try it yourself here: https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_get_current_window
Read more about the window
object in our JavaScript Window Tutorial.