Forum Moderators: open

Message Too Old, No Replies

Resizing Browser Windows - Help Needed

         

johanisk

7:42 pm on Aug 27, 2003 (gmt 0)

10+ Year Member



First post, so excuse my ignorance.

I am trying to put together a website that consists of two frames (a top one for the content and a bottom one for the menu) and I want to resize the browser window to make it narrower).

I'd like the window to be resized from as soon as the person enters the URL of the site.

From what I can glean, Javascript is what I should be using to do this.

Can anyone help me out or point me in the direction of any good sources where I can read up about this. The problem I always have with trying Java things is that I never quite know where I should be putting the bits of code to make it all work!

Thanks for reading this

Colin

korkus2000

7:53 pm on Aug 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to the board johanisk,

You need to put javascript in script tags. They can basically go anywhere on a page, but mostly putting them in the head is standard. Resizing a window script should be placed in the head.

<script>
function resizeWindow(width,height){
if (document.layers) {
// resizeTo sets inner size, so use this instead
window.outerWidth = width;
window.outerHeight = height;
} else window.resizeTo(width,height);
}
</script>

Then you just call the function from an onload event handler in your body tag like:

<body onload="resizeWindow(800,600);">

The function all fires when the page finishes loading the elements on the page and passes the height and width you want.

I would be carefull about messing with browser sizes though. People wanted it the way they had it. I find it obtrusive and annoying. I believe you should create a window you have ownership of or pop-up and size that.

johanisk

8:24 am on Aug 28, 2003 (gmt 0)

10+ Year Member



Thanks for that - very helpful!

I agree with you on the resizing windows issue - I was just keen to know how to do it so I could apply it to specific, non-annoying stuff!