Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3807126
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:56:30+00:00 2026-05-19T14:56:30+00:00

I have the following webpage: A tall webpage with only a vertical scrollbar and

  • 0

I have the following webpage:

A tall webpage with only a vertical scrollbar and no horizontal scrollbar. The document and window therefore have the same width.

When I ask IE8 for $(document).width(), it returns the viewport width including the vertical scrollbar. FF returns the right answer.

I cannot use $('body') for this, because it returns the same width as the window object (it is set to 100% somehow, so it doesn’t work when the page gets smaller).

How can I make IE8 output the right value? Thanks in advance.

UPDATE

I actually did some more testing to my problem. and I found that when the horizontal scrollbar becomes visible as well (because of a smaller window), IE8 DOES get the right size. So this makes my problem even more complicated because I can’t set an ugly if(IE8)-hack.

UPDATE2

The problem lies in my CSS and jQuery.
The actual case seems to be the problem:
My css says:

body
{
    overflow-y:scroll;
}

IE8 doesn’t count this as part of the body, but IE7 does. How to fix this? Call jQuery for a fix?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T14:56:31+00:00Added an answer on May 19, 2026 at 2:56 pm

    I put this problem to the jQuery crew: http://bugs.jquery.com/ticket/8048.

    They don’t think it’s a bug. Their advice is to use $('body').width(). And this does indeed the job for me.

    I still find it strange that the body in IE8 is adjusted to the scrollbar, but the $(document).width() stays the same. I used this jsFiddle for testing. It results in the same glitch, but jQuery thinks it’s ok, because W3C doesn’t say anything about it… Or something like that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a following code for rotating images on webpage <script type=text/javascript> $(document).ready(function() {
I have the following webpage which works in IE7 but not in IE8; The
I have the following directory structure : /script/x.js /includes/x.txt /1/2/index.html After hooking a webpage
I have a webpage including the following div: <div class='book_box'> <table border=0 cellspacing=0> <tr>
I have made the following webpage for generating interactive todo lists: http://robert-kent.com/todo/todo.php Basically, the
Suppose I have the following within a webpage <% using (Html.BeginForm(ShowData, Summary)) %> <%
I have the following code on a webpage: <div id=emails> <ul> <li>email1</li> <li>email2</li> </ul>
On a webpage, I have markup like the following: <h3>Title Goes here</h3> <a href=...>Link
i have the following javascript in my webpage: var xhr = new XMLHttpRequest(); xhr.open('GET',
I have the following code in my webpage - the map div is not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.