JavaScript Window Screen

JavaScript Window Screen

The window.screen object contains information about the user's screen.

Window Screen

The window.screen object can be written without the window prefix.

Some properties:

screen.availWidth - Available screen width screen.availHeight - Available screen height

Window Screen Available width

screen.availWidth Property returns the width of the visitor's screen, in pixels, minus interface features such as the window taskbar.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php中文网(php.cn)</title>
</head>
<body>
<script>
document.write("可用宽度: " + screen.availWidth);
</script>
</body>
</html>

Window Screen Available Height

The screen.availHeight property returns the height of the visitor's screen, in pixels, minus interface characteristics, such as Window taskbar.

Usage is the same as width.

Continuing Learning
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文网(php.cn)</title> </head> <body> <script> document.write("可用宽度: " + screen.availHeight); </script> </body> </html>
submitReset Code