Use the screen.availWidth property to return the width of the user’s screen. The result will be in pixels and the Taskbar feature won’t be included.
Example
You can try to run the following code to learn how to work with the screen.availWidth property in JavaScript −
<!DOCTYPE html> <html> <body> <script> document.write("Width of the user’s screen: "+screen.availWidth); </script> </body> </html>