Solved

sizeToContent() for IE

Posted on 2003-10-22
10
1,098 Views
Last Modified: 2010-05-18
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?
0
Comment
Question by:mltolun
[X]
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
  • 5
  • 3
10 Comments
 
LVL 12

Expert Comment

by:ahosang
ID: 9602279
0
 
LVL 12

Accepted Solution

by:
ahosang earned 100 total points
ID: 9602294
The relevant part being this:
<html>
<head>
<title></title>
<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 = window.open("","blah","resizable=no,width=600,height=200");
   var str="<html><head><title>EmilyHorridge.com - photo</title>";
   str+="<scri"+"pt>if (!window.sizeToContent) {function sizeToContent(img) {\n";
   str+="x=img.width;y=img.height;\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>";
   newwin.document.write(str);
   newwin.document.close();
}
// -->
</script>
</head>
<body>
<a href="#" onClick="openemh('http://www.emilyhorridge.com/images/Gallery/Abercarn1.jpg');return false">
<img name="img1" src="http://www.emilyhorridge.com/images/gallery_thumbs/Abercarn1.jpg" width="85" height="85" border="0"></a>
</body>
</html>
0
 
LVL 12

Expert Comment

by:ahosang
ID: 9633177
Is this helping you?
0
Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

 

Author Comment

by:mltolun
ID: 9641775
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.
0
 
LVL 12

Expert Comment

by:ahosang
ID: 9643000
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.
0
 

Author Comment

by:mltolun
ID: 9644993
But the title bar height can vary. In my windows has 20px....but in a friends windows has 30px...so...
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.
0
 

Author Comment

by:mltolun
ID: 9711836
SO??
hi?
0
 
LVL 12

Expert Comment

by:ahosang
ID: 9714385
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.
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 10345841
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.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jAy
EE Cleanup Volunteer
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

717 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