Posted By

Corhol on 09/04/06


Tagged

javascript window detection


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

rchk


getBrowserWidth() by Cameron Adams


 / Published in: JavaScript
 

  1. // getBrowserWidth() by Cameron Adams
  2. // http://www.themaninblue.com/experiment/ResolutionLayout/
  3. function getBrowserWidth ( ) {
  4. if ( window.innerWidth ) { return window.innerWidth; }
  5. else if ( document.documentElement && document.documentElement.clientWidth != 0 ) { return document.documentElement.clientWidth; }
  6. else if ( document.body ) { return document.body.clientWidth; }
  7. return 0;
  8. }

Report this snippet  

You need to login to post a comment.