Get Available Width and Height excluding your toolbars

Often we come across problems with the available screen area with different screen resolutions. The major problem is with the toolbars, somebody having the default toolbars of the browsers, and some buddy will have more toolbars installed, like Google , Y! etc. And even some users will have the taskbar twice the height of the default height for showing the quick launch bar, custom toolbars in the task bar, more tray icons.

The Problem is to find the available screen space excluding the toolbars in different resolutions. Here is a simple way of doing this.
First we find the resolution and then the available real estate/space for showing our stuff. The following function will do that.

 function init(){
var screenH = screen.height;
    var screenW = screen.width;
    alert("Your Screen Resolution:n" + screenW + "px x " + screenH + "px");
        availW = document.body.clientWidth;
        availH = document.body.clientHeight;
        availW = innerWidth; availH = innerHeight;
    alert("Available Space exculing the Toolbars:n" + availW + "px + x " + availH + "px"); } 

6 Replies to “Get Available Width and Height excluding your toolbars”

  1. I use such method as alternative (example for height only):

    function Get_available_height() {
    var window_height = 0;
    if (typeof (window.innerHeight) == ‘number’) {
    window_height = window.innerHeight;
    else {
    if (document.documentElement && document.documentElement.clientHeight) {
    window_height = document.documentElement.clientHeight;
    else {
    if (document.body && document.body.clientHeight) {
    window_height = document.body.clientHeight;
    return window_height;

  2. This particular smubit has been extremely nicely composed, and it also contains numerous useful information. My partner and i appreciated your own expert way of writing this publish. You’ve made it quite simple will realize.

Leave a Reply to dms Cancel reply

Your email address will not be published. Required fields are marked *