Javascript Browser Screen availWidth Property

Introduction

Get the available width of your screen:

var x = "Available Width: " + screen.availWidth;

Click the button to display the available width of your screen.

View in separate window

<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">Test</button>

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

<script>
function myFunction() {/*from www.ja v  a 2 s.  c o m*/
  var x = "Available Width: " + screen.availWidth + "px";
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The availWidth property returns the width of the user's screen, in pixels, minus Windows Taskbar.




PreviousNext

Related