window width

B

Ben

Hi at all

I read that it is possible to detect CROSSBROWSER the body width still
scrollbars (without scrollbars) with this:

var window_width_without_scrollbar=

document.documentElement.clientWidth || document.body.clientwidth;



Fiurefox return the some width of screen.width



msie 7 return 0 or indefined

In any case size is vorng and with msie my page make eroor and with ff size
is too big

Pòease How can I do ?

Thankyou
 
B

Bart Van der Donck

Ben said:
I read that it is possible to detect CROSSBROWSER the body width still
scrollbars (without scrollbars) with this:

var window_width_without_scrollbar=

document.documentElement.clientWidth || document.body.clientwidth;

Fiurefox return the some width of screen.width

msie 7 return 0 or indefined

In any case size is vorng and with msie my page make eroor and with ff size
is too big

Pòease How can I do ?

http://www.jibbering.com/faq/#FAQ4_9
 
B

Ben

"Bart Van der Donck" <[email protected]>
wrote

http://www.jibbering.com/faq/#FAQ4_9

--
Bart

OK but in this page I found:

var winWidth, winHeight, d=document;
if (typeof window.innerWidth!='undefined') {
winWidth = window.innerWidth;
winHeight = window.innerHeight;
} else {
if (d.documentElement &&
typeof d.documentElement.clientWidth!='undefined' &&
d.documentElement.clientWidth!==0) {
winWidth = d.documentElement.clientWidth;
winHeight = d.documentElement.clientHeight;
} else {
if (d.body &&
typeof d.body.clientWidth!='undefined') {
winWidth = d.body.clientWidth;
winHeight = d.body.clientHeight;
}
}
}

To try I add:

alert(winWidth);
alert(winHeight);

Firefox aanswer: 1024 and 603

MSIE 7.0 answer: 1003 and 563

what is the true answer?????????????????????????????????????????????????

I think that of MSIE
 
M

Matthias Watermann

[...]
Firefox aanswer: 1024 and 603

MSIE 7.0 answer: 1003 and 563

what is the true answer?????????????????????????????????????????????????

Impossible to say without knowing how big a screen area you gave the
respective browser windows. Just count the pixels yourself in each
browser window and compare your result with the browser's output.


--
Matthias
/"\
\ / ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
X - AGAINST M$ ATTACHMENTS
/ \
 
T

Tom Cole

[...]
Firefox aanswer: 1024 and 603
MSIE 7.0 answer: 1003 and 563
what is the true answer?????????????????????????????????????????????????

Impossible to say without knowing how big a screen area you gave the
respective browser windows. Just count the pixels yourself in each
browser window and compare your result with the browser's output.

--
        Matthias
    /"\
    \ /    ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
     X                           - AGAINSTM$ ATTACHMENTS
    / \

In my experience, MSIE leaves out the space required by the vertical
scrollbar, even if it's not visible, giving you the width minus the
scrollbar width. Opera, Firefox and Safari give you the actual visible
width.
 

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

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top