How to get page scroll exact height using Javascript?

Hi All, After long search I have made below function to return total scroll height of current page. please check the below function.

   function getScrollHeight(){
              var seachbody = document.body, seachhtml = document.documentElement;
              var searchheight = Math.max( seachbody.scrollHeight, seachbody.offsetHeight,
                         seachhtml.clientHeight, seachhtml.scrollHeight, seachhtml.offsetHeight );
     return searchheight;
}

Leave a Reply

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