How to know the browser width and height on each browser ?

How to know the browser width and height on each browser ?

Hi, for now, I'm doing this with this code :

   
  1.  var navWidth, navHeight;

    if (self.innerWidth != undefined)

    {

    navWidth = self.innerWidth;

    navHeight = self.innerHeight;

    } else {

    navWidth = document.documentElement.clientWidth;

    navHeight = document.documentElement.clientHeight;

    }

The problem is that it's not working on Android browser :/

How can I fix that please ?