IE browser window size

Posted on 2003-02-21
Medium Priority
Last Modified: 2012-06-27
Okay, so there are many tutorials on adjusting the browser window size with javascript but none of them address the following issue.  

In IE, the self.resizeTo(X,Y) function sets the outside dimension of the browser window.

document.body.clientWidth gives the internal window size without the scroll bar.

document.body.offsetWidth gives the external window size with the scroll bar

(document.documentElement for IE 6)

BUT and here is the issue, neither of them give the window size WITH the "history picker" or "search sidebar" if they are on in the window.  So I'm stuck trying to figure out how to actually make my page display correctly (designed for 800x600 760x420 useable) using offsetWidth with resizeTO.  Or any other method for that matter if the client is using IE with their history/search sidebar open.

Thanks in advance for your help.
Question by:thorir
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
LVL 63

Expert Comment

ID: 7994035
So you ask for the full screen size?

Here it is:
alert(screen.availWidth+" X "+screen.availHeight)

LVL 63

Expert Comment

ID: 7994072
Oh, here your line:



Author Comment

ID: 7994084
No, I have the full screen size, that isn't the problem.  I'm looking to resize or calculate the USEABLE browser window size not the entire browser window.
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 7994093
Hmm, apparently I'm not making myself real clear.  I'm not trying to maximize the window.  Just make it big enough to display the page correctly if they have the search or history sidebar open.
LVL 63

Accepted Solution

Zvonko earned 330 total points
ID: 7994261
Bigger then maximized is not possible, so what dimensions are you asking for?

Are you asking for displaying minimized to a particular content size?


Author Comment

ID: 7994334
Yeah, minimized to the content size of 760x420, but if I resizeto that and they have their search sidebar open, I'll loose 100pixels of the width and the page won't look right.  With netscape/mozilla/opera it is easy I just do:

if( window.innerWidth < 760)
window.innerWidth = 760;
if( window.innerHeight < 420)
window.innerHeight = 420;

Expert Comment

ID: 7996452
You would still use Zvonko's suggestion, but check for IE...

If it's IE, you use screen.availWidth and screen.availHeight... otherwise, use the good stuff.

I hate proprietary implementations... JScript should go bye bye IMHO.

Author Comment

ID: 8009155
I still haven't resolved this.  Anyone?

I'm not trying to maximize the window.

I'm trying to minimize it without affecting the apperance of my content if someone has an IE search/history bar open in their browser.

Any help would be breatly appreciated.

Author Comment

ID: 8011763
Well, this is how I resolved this issue:

Here's one method to calculate the outer dimensions of the browser
window in IE. The basic steps are:

  1. Save the current inner dimensions.
  2. Resize the window using fixed values.
  3. Subtract the new inner dimensions from those fixed values. This
     difference is the amount of "chrome" horizontally and vertically.
     Save these values in global variables.
  4. Restore the window to its original size by adding the "chrome"
     values to the saved inner dimensions.

Any way I can give myself back my points?
LVL 63

Expert Comment

ID: 9149959

Author Comment

ID: 9150016
Yeah, well, I appreciated your attempt to help :).


Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question