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 1008669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:48:24+00:00 2026-05-16T08:48:24+00:00

Chrome (and IE when browsing local files) gives an initial value for the clientHeight

  • 0

Chrome (and IE when browsing local files) gives an initial value for the clientHeight of a textarea element that is incorrect. How do I get IE and Chrome to give the correct values? (Problem demo’ed here)

I am setting the position and size of the textarea via CSS fixed/absolute positioning. Then I am checking the value of clientHeight via jQuery.

The problem does not happen all the time, but is consistently reproducible. Specifically, the following conditions are required:

  1. Using Chrome (5.0). (Also IE (8.0) if the file is opened from the local computer.)
  2. Browser window is maximized.
  3. jQuery is included inline (vs. linked as an external file)
  4. The page has not been loaded since the browser was started.
  5. My app has not processed any commands, yet.
  6. The variable paddingLines is dynamically determined based on clientHeight. (Setting to 50 every time is a work-around.)

I need accurate clientHeight and scrollHeight values because I use these properties to determine where to ‘snap’ the textarea scrollHeight to so the last output starts on the first line of the text area. Actually, if the properties were consistently inaccurate between calls it would still work. Unfortunately, the inaccurate properties are adjusted to their correct values by the time the first command is processed.

I have tried to isolate the problem in a demo here. When I tried to make an even simpler sample, the problem did not reproduce as consistently. I think there are some timing and/or browser optimization issues because the following work-arounds make the problem go away:

  1. Setting the variable paddingLines to 50 every time (instead of dynamically calculating it based on clientHeight)
  2. Including jQuery as an external file (instead of inline)
  3. Adding a short delay (as short as 2 milliseconds) before the textarea is initialized.
  4. Loading the app in IE from a server (vs. opening from the local computer)

However, these work-arounds are only kludges and I would prefer to find the true cause/solution to the problem. Although this is a minor aesthetic problem, I wish to gain a deeper understanding of how the Html DOM, CSS and jQuery work in different browsers. Is there something wrong with my code?

Notes:

  • The causes for Chrome’s inaccurate properties seem to be different than IE’s
  • Chrome’s innaccurate clientHeight seems to be based on the non-maximized size of the browser.
  • IE’s innacurate clientHeight may be affected by the info bar warning about unsafe scripts.
  • 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-16T08:48:24+00:00Added an answer on May 16, 2026 at 8:48 am

    I never figured out the root cause, but I found an acceptable workaround that doesn’t depend on pausing a magic number of milliseconds:

    Handle the resize event. This event is triggered when the browser opens for the very first time, even if the user did not manually resize the window. The values of clientHeight and scrollHeight have settled in all browsers by this point.

    $(window).resize(function(e) {
        // Called when the browser is first opened.
        // Values of clientHeight and scrollHeight have settled by this point.
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While browsing with Chrome, I noticed that it responds extremely fast (in comparison with
Every tab in google chrome has an id that is unique for that browsing
The Chrome debugger tells me that it found for example 42 occurrences of a
I've launched an application last week and have noticed since that in Chrome only
In using the HTML5 WebStorage functionality, I know that certain browsers, like Chrome, have
How can I check if a certain link is found in Chrome's browsing history(on
My goal is to create a caret browsing extension in google chrome. I have
There is a problem with Facebook applications/page tabs and Chrome/Internet Explorer users that have
hey guys, I'm browsing with chrome and so spoiled with native css mediaqueries support.
I've created a website that displays perfectly on Chrome, Firefox, Safari, and Internet Explorer

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.