Auto-Resizing a Webpage

  DoctorButcher 20:55 01 Nov 03

Is there a script that can automatically resize a webpage to match the viewers' screen?

Our club website click here has been built at a resolution of 1024x768, and i was wondering if there was a script available to shrink the page so it fits into 800x600 without having to re-code the page.


  Pesala 21:15 01 Nov 03

click here to see an earlier thread.

What program do you use to create your website?

  Taran 21:34 01 Nov 03

Put this just before your closing </head> tag:

<script language="JavaScript1.2">


if (document.all) {
else if (document.layers||document.getElementById) {
if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
top.window.outerHeight = screen.availHeight;
top.window.outerWidth = screen.availWidth;


  Taran 21:37 01 Nov 03

The code format got a bit mangled, but if you copy and paste it into your document, it has to go bwteen the <head></head> tags to work.



  Pesala 12:14 02 Nov 03

I tried cutting and pasting the code, but it made no difference. Perhaps it needs to be reformatted correctly?

  Taran 12:31 02 Nov 03

I've just tried it in Notepad and it works a treat.

I'll take another shot at it, but this is the code I always use for a straight HTML page to open maximised.

I'll get back to you.


  Taran 12:38 02 Nov 03

Out of curiosity, which browser did you test it in ?

I've just run it through IE and Firebird and it worked fine with both.

Try reducing the browser to half screen size then open up an HTML document with the above code pasted in bevfore the closing </head> tag.

Keep in mind that it's JavaScript, so it requires a browser with at least rudimentary Java capabilities.


  Pesala 12:48 02 Nov 03

Javascript is enabled.

This page click here which I just uploaded includes your javascript between the <head> tags, but it doesn't resize to fit the window.

I pasted the code in the masterborder HTML in NOF.

  Pesala 12:51 02 Nov 03

Looking at Brian's page, there seems no scope for resizing his page as it is mostly graphics. Will your javascript or any method resize everything on the page, like zooming out in Opera, and not just the width of text frames?

  Taran 13:00 02 Nov 03

It merely opens up the browser in a maximum available screen space with the page contents displayed normally.

If you want your page content to resize you use different methods entirely.

If the page is full of large images to begin with then the aboveJavaScript may or may not have any direct effect.

I've not tried pasting the code into NOF but I suspect that is where the problem lies. I know it works using FrontPage, Notepad (and all other simple text editors), Dreamweaver, GoLive and several others, but I've yet to try it using NOF and even if/when I do, there's no guarantee I can replicate your results since your version does not support the same features mine does.

Who'd be a web designer ?


  Pesala 13:07 02 Nov 03


This thread is now locked and can not be replied to.

iPhone 7 Plus review: better cameras and waterproofing make this the best iPhone yet

1995-2015: How technology has changed the world in 20 years

Apple to launch new Macs and MacBook Pros at an event on October 27

iPhone vs Android | iOS vs Android: 5 reasons why Apple's iPhones beat Google Android smartphones ()…