jQuery returns incorrect window height

I have a site (it's an intranet, so I can't give a link) which uses jQuery.ui dialogs to show messages.
It uses only jQuery and jQuery.UI plus some of our own JS and CSS.
When the page content is much bigger than the view port (the browser window) (so there is vertical scroll bar appears) the dialog is shown at the bottom of the browser's window. Also the opposite is true, when the page content is much less to the browser's window, the dialog is aligned to the top edge.
I've found out that on this site the following expression is always equals true (in Chrome and Mozilla, but not in IE) and I believe that is the reason for the dialog misplacing.
$(document).height()===$(window).height() 

Open in new window

On other sites these two methods return different sizes of the page content and the viewport accordingly.
What could be a cause for that?
LVL 21
zc2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dave BaldwinFixer of ProblemsCommented:
For what it's worth, this page has all the info too:  http://www.dibsplace.com/webdev/browserinfo.html   Feel free to copy it if you want.
Julian HansenCommented:
The selected answer is a blind link - here is the recommended solution from that page.

If the page is missing the <!DOCTYPE> declaration - jQuery will return a document height that is equal to the window height.

Adding the <!DOCTYPE html> declaration to the top of the page should fix this issue.

From the page https://viralpatel.net/blogs/jquery-window-height-incorrect/
Our HTML document doesn’t have DOCTYPE declaration. So it’s not a valid HTML so to speak. JQuery cannot calculate window height / document height correctly if doctype is not specified on window.

The <!DOCTYPE> declaration is not an HTML tag; it is an instruction to the web browser about what version of HTML the page is written in.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.