Added: 21st of December 2022
Viewed: 624 times
The script below displays the window width and window height dimensions.
When the window is resized the window dimensions are reloaded using the window.addEventListener resize function.
We assign window.innerWidth and window.innerHeight properties to variables and then use the document.write to print the dimensions on the screen.
Create a new file on your Desktop named windowDimensions.html, copy and paste the code below then save the file. Launch the file in your browser.