Get the available width of your screen:
let width = screen.availWidth;
Try it Yourself »
More "Try it Yourself" examples below.
The availWidth
property returns the width of the user's screen.
The availWidth
property returns the width in pixels.
The availWidth
property returns the width minus interface features like the Windows Taskbar.
The availWidth
property is read-only.
To get the height of the screen, use the availHeight property.
screen.availWidth
Type | Description |
A number | The width of the user's screen in pixels. |
All screen properties:
let text = "Total width/height: " + screen.width + "*" + screen.height + "<br>" +
"Available width/height: " + screen.availWidth + "*" + screen.availHeight + "<br>" +
"Color depth: " + screen.colorDepth + "<br>" +
"Color resolution: " + screen.pixelDepth;
Try it Yourself »
screen.availWith
is supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!