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

M

mbasil7

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.
 
R

RobG

mbasil7 said:
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:

<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.

[...]
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top