Results 1 to 6 of 6

Thread: Browser size

  1. #1

    Thread Starter
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303

    Question Browser size

    I can get the size of the overall screen, but is it possible to get the current window size of the browser?
    Thanks in advance for any help provided.

    VB 6 Enterprise Edition SP4
    ADO, SQL 7/2000, ASP and some JavaScript


    >> Life goes on, but for how long? <<
    If you can smile when things go wrong, you have someone in mind to blame

  2. #2
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404
    do you mean the displayable region of the page or the overall window size ?

  3. #3

    Thread Starter
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303
    Hello again, I mean the displayable region. If I set my screen res to 1024*768, but change my browser window size, its that I'm trying to get.
    Thanks in advance for any help provided.

    VB 6 Enterprise Edition SP4
    ADO, SQL 7/2000, ASP and some JavaScript


    >> Life goes on, but for how long? <<
    If you can smile when things go wrong, you have someone in mind to blame

  4. #4
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404
    Netscape only, as yet I've never found a way of determining it in IE

    Code:
    <script>
    if (document.all){
    	alert("i dunno guv, it's a mystery");
    }else{
    	alert(window.innerWidth + " x " + window.innerHeight);
    }
    </script>

  5. #5
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404
    found it!

    This is how you do it in IE and Netscape.

    It needs to be in an onload event or the ie version wont work!


    Code:
    <script>
    function getWindowStats(){
    	if (document.all){
    		alert(document.body.clientWidth + " x " + document.body.clientHeight);
    	}else{
    		alert(window.innerWidth + " x " + window.innerHeight);
    	}
    }
    </script>
    <BODY onload="getWindowStats()">
    Next!

  6. #6

    Thread Starter
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303
    Many thanks, saved me some headaches
    Thanks in advance for any help provided.

    VB 6 Enterprise Edition SP4
    ADO, SQL 7/2000, ASP and some JavaScript


    >> Life goes on, but for how long? <<
    If you can smile when things go wrong, you have someone in mind to blame

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width