Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Is there a way to detect the width of the browser scrolling bar?

Reply
Thread Tools

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

 
 
mbasil7
Guest
Posts: n/a
 
      06-30-2005
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.
 
Reply With Quote
 
 
 
 
RobG
Guest
Posts: n/a
 
      07-01-2005
mbasil7 wrote:
> 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.


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

<URL:http://www.quirksmode.org/>

> <script language="JavaScript" type="text/JavaScript">


The language attribute is depreciated, remove it. Keep the required
'type' attribute.

> <!--


Hiding scripts is not necessary, potentially harmful and of zero
benefit.

[...]

--
Rob
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
set div width to remaining width of the browser Steve Richter ASP .Net 2 06-15-2007 06:40 PM
how to: div width = browser.width? =?Utf-8?B?cm9kY2hhcg==?= ASP .Net 3 10-30-2006 05:43 AM
Textbox width scaling to width of data not width of page? AndrewF ASP .Net 1 10-10-2005 04:38 PM
css - setting width based on browser width ppcguy HTML 3 08-26-2005 06:51 AM
Fixed layout width based on browser window width msswasstastic@aol.com HTML 11 01-28-2005 07:36 AM



Advertisments