PDA

View Full Version : Forcing Frame Size


dremmers
01-20-2003, 03:45 PM
How do you force a browser to adjust it's window size when loading a frame?

I have:
<frameset cols="110,610" border="0" frameborder="0" framespacing="0">

and I also tried

window.resizeTo(720.*)


but either way the browsers (IE and N4), just seem to ignore it. It doesn't appear to have any affect on the window size.

What am I doing wrong?

ecnarongi
01-20-2003, 04:29 PM
in my experiences the above has worked fine. What you might be experiencing is your page is too short or too narrow to accomodate the parameters that you set. Something like this can happen without us knowing what's going on.

dremmers
01-20-2003, 05:07 PM
Hmm...

The problem may also have to do with the fact that the window.resizeTo is part of the first frameset, which breaks it down into to ROWS. The COLUMN break (which is what I need to be exact) is in a second frameset.

And it's also possible that my window.resizeTo is not in the right place.

In my index.html, I have:

<html>
<head>
<script>
window.resizeTo(720,*);
var myimages=new Array()
function preloadimages(){
for (i=0;i<preloadimages.arguments.length;i++){
myimages[i]=new Image()
myimages[i].src=preloadimages.arguments[i]
}
}
preloadimages("http://blahblahblah.gif")

</script>
</head>
<frameset rows="55,*" border="0" frameborder="0" framespacing="0">
<frame src="header.html" frameborder="no" bordercolor="#FFFFF0" marginwidth="10" marginheight="10" noresize scrolling="no">
<frame src="BottomFrame.html" name="bottom" frameborder="0" bordercolor="#FFFFF0" marginwidth="1" marginheight="1">
</frameset>
</html>

Does that look right to you? I realize the window.resizeTo is Javascript...

Thanks!

dremmers
01-20-2003, 08:03 PM
window.resizeTo requires both arguments.

I was putting in an asterisk, thinking it would just default to the current height. Turns out it just ignores the code (doesn't even produce an error message).

Of course now I'm having a different problem in that the dimensions I need in Netscape are different than those in IE. Grrrr....

Thanks anyway.

ha!
01-20-2003, 11:26 PM
Just replace the html of your frame page with following. works like charm

<HTML>
<HEAD>
<script>
self.moveTo(0,0);
self.resizeTo(screen.availWidth,screen.availHeight);
</script>

ha!
01-20-2003, 11:33 PM
Your problem can be solved by the following script.

All you have to do is to make two different pages for IE and NS and have your index or default page, redirect according to browser

Here is the code

just change your URL below and you are good to go

<script>
var browser_type=navigator.appName
var browser_version=parseInt(navigator.appVersion)
//if NS 6
if (browser_type=="Netscape"&&browser_version>=5)
window.location.replace("http://your page.com")
//if IE 4+
else if (browser_type=="Microsoft Internet Explorer"&&browser_version>=4)
window.location.replace("your page.com")
//if NS4+
else if (browser_type=="Netscape"&&browser_version>=4)
window.location.replace("your page.com")
//Default goto page (NOT NS 4+ and NOT IE 4+)
else
window.location="your page.com"
</script>

Have Fun

dremmers
01-21-2003, 12:33 PM
Actually, the solution I came up with is much simpler and doesn't require multiple pages. It is:

if (navigator.appName == "Microsoft Internet Explorer"){
window.resizeTo(800,500);
}
else {
window.resizeTo(750,350);
}

Of course I HAD been scratching my head because it didn't seem to detect IE, but thanks to your comments above I see that I needed TWO = . Argh. That always gets me!:D

P.S. I like the availWidth/Height idea. I'll play around with it. I don't need all of the height, though, just the width.