sizeToContent() for IE

I need to size the window to the content of the document, which is only an image smaller than 800x600 to fit in standar monitors.

NN has a function called "sizetoContent()" determines the optimum window size to display the window content, how can I do the same but for IE browsers?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

ahosangFinance Systems DeveloperCommented:
ahosangFinance Systems DeveloperCommented:
The relevant part being this:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function openemh(bigSrc) {// the parameter is the url of the large version of the thumbnail
   newwin ="","blah","resizable=no,width=600,height=200");
   var str="<html><head><title> - photo</title>";
   str+="<scri"+"pt>if (!window.sizeToContent) {function sizeToContent(img) {\n";
   str+="window.resizeTo(x, y);}}</scr"+"ipt>";
   str+="</head><body topmargin='0' leftmargin='0'>";
   str+="<img src=\""+bigSrc+"\" border=\"0\" onload=\"sizeToContent(this)\"></body></html>";
// -->
<a href="#" onClick="openemh('');return false">
<img name="img1" src="" width="85" height="85" border="0"></a>

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
ahosangFinance Systems DeveloperCommented:
Is this helping you?
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

mltolunAuthor Commented:
ummm....I'm not sure...
The "window.resizeTo" function does not resize to the content. It includes the title bar in the height value.
If my pic has 80px of height and I use the "resizeTo" function with 80px value for the height and the title bar is 20px, only 60px of my pic will be shown.
ahosangFinance Systems DeveloperCommented:
Yes, in that thread there was the discussion of the fact that you must make a small adjustment to the x an y values. It should work perfectly on Mozilla, but IE needs a small adjustment.
mltolunAuthor Commented:
But the title bar height can vary. In my windows has 20px....but in a friends windows has
I need to forget about the title bar, and only size the content.
Or know the title heigh and add it to the height parameter.
mltolunAuthor Commented:
ahosangFinance Systems DeveloperCommented:
There is no exact way to know what the heights of these browser components are. In IE the window can be sized the way I showed you, so maybe better to oversize it, or open a new window with no title bars or toolbars as I did in that code above.
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: ahosang {http:#9602294}

Please leave any comments here within the next four days.

EE Cleanup Volunteer
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

From novice to tech pro — start learning today.