View Full Version : Browser window, want to force size only ONCE!!

06-21-2007, 12:23 PM

I'm using the following javascript -

<script Language="JavaScript">
var width=980;
var height=800;

to make the home page of a site open at 980 x 800 px...this works fine. Then once the homepage is loaded, the user can expand or retract the size of the browser or make it full screen on any page. This IS what I want. However, if for example you make the site full screen, go through the pages of the site, then click back to the homepage, obviously the homepage will go back to 980 x 800....this is NOT what I want!

Is there a way of making the browser a certain size only on first loading? Might sound like a strange request, but it is a liquid site that stretches to fill the browser (at client's request), just think the homepage looks nicer a bit narrower...

Make sense?!



06-21-2007, 12:29 PM
cookies or possibly url querystring

you set either after the first initial loading then just check if they are set before resizing from the first instance

06-21-2007, 01:12 PM
Thanks for the quick reply ;-)

How would I acheive this with url query string? Haven't got a clue where to start!

06-21-2007, 02:03 PM
Or you could have a doorway page first, regular html page with a javascript link to open homepage in certain size.

06-21-2007, 02:05 PM
that would be better

the JS coding which writes a URL querystring is advanced and prone to fall over if the user has JS switched off

06-21-2007, 03:16 PM
Ok, but even with a 'doorway' page once the homepage is opened at the set size, if you were to resize the browser while looking at the 'contacts' page (for example) and then go back to the home page later, the browser would snap back to the set size (which i don't want).....is that right?!

Thanks for the replies guys :-)

06-21-2007, 03:38 PM
No, you would go back to the homepage (that is loaded after the doorway page) and there is no javascript code on that page.

The javascript to change the size of the new window is on the doorway page, basically you're opening a pop-up window from the doorway page.

06-21-2007, 04:36 PM
Ah ok...thanks! I was wondering if there was a way of avoiding making it a pop-up, don't most people have them blocked?

06-22-2007, 07:13 AM
allot of people do but a message is displayed to advise this. I normally ignor popups if the content i wanted is there in front of me coz i asume its an advert. I do use popups for applications development as they are great for displayig sub data