Auto-Resizing a Webpage

  [DELETED] 20:55 01 Nov 2003

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.


  [DELETED] 21:15 01 Nov 2003

click here to see an earlier thread.

What program do you use to create your website?

  [DELETED] 21:34 01 Nov 2003

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;


  [DELETED] 21:37 01 Nov 2003

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.



  [DELETED] 12:14 02 Nov 2003

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

  [DELETED] 12:31 02 Nov 2003

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.


  [DELETED] 12:38 02 Nov 2003

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.


  [DELETED] 12:48 02 Nov 2003

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.

  [DELETED] 12:51 02 Nov 2003

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?

  [DELETED] 13:00 02 Nov 2003

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 ?


  [DELETED] 13:07 02 Nov 2003


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

Elsewhere on IDG sites

How to watch the World Cup for free on TV and online

Meet Superfiction, the little design studio with a load of character

Best Mac music-production software

Comment savoir si votre message a été lu sur Facebook & WhatsApp ?