Is there a way to detect the width of the browser scrolling bar?

Discussion in 'Javascript' started by mbasil7, Jul 1, 2005.

  1. mbasil7

    mbasil7 Guest

    Hi at all.

    Is there a way to detect with javascript the scrolling bar with of the
    browser?

    My problem is that the the following script assing to the pos
    variable the browser window size but only internet explorer substracts
    the scrolling bar with from the result.
    <script language="JavaScript" type="text/JavaScript">
    <!--
    var pos;

    if (window.innerWidth)
    {
    pos =window.innerWidth;
    }
    else if (document.documentElement &&
    document.documentElement.clientWidth)
    {
    pos= document.documentElement.clientWidth;
    }
    else if (document.body)
    {
    pos= document.body.clientWidth;
    }

    //-->
    </script>

    At least i want to ask if there is a script that return exactly the
    width of the browser's window that i have to output any text or
    graphic?

    Thanks in advance.
     
    mbasil7, Jul 1, 2005
    #1
    1. Advertisements

  2. mbasil7

    RobG Guest

    For a pretty thorough treatment of browser viewport issues, have a look
    at the 'viewport' link at Quirksmode:

    The language attribute is depreciated, remove it. Keep the required
    'type' attribute.
    Hiding scripts is not necessary, potentially harmful and of zero
    benefit.

    [...]
     
    RobG, Jul 1, 2005
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.