Screen availWidth Property - Javascript Browser Object Model

Javascript examples for Browser Object Model:Screen


The availWidth property returns the width of the user's screen, in pixels, minus interface features like the Windows border.

Return Value

A Number, representing the width of the user's screen, in pixels

The following code shows how to get the available width of your screen:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

function myFunction() {//  www.  j  a va  2 s .co m
    var x = "Available Width: " + screen.availWidth + "px";
    document.getElementById("demo").innerHTML = x;


Related Tutorials