Auto-Resizing a Webpage

  DoctorButcher 20:55 01 Nov 2003
Locked

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.

Cheers,
Brian

  Taran 10:13 03 Nov 2003

No, you don't need to remove any of the code Dreamweaver inserts into the page by default.

You normally get the following embedded into a Dreamweaver page head tag:

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

This does not interfere with inserting a separate JavaScript; it merely indicates to the web browser what the page contents are and how it should interpret them.

T

  DoctorButcher 17:19 03 Nov 2003

Thanks for that, Taran...

This is the script i was referring to. Dreamweaver has it inserted into the head of all my pages:

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>

What does it do and will it interfere with the code you have provided?

Cheers,
Brian

  Taran 18:28 03 Nov 2003

The code you've listed is a reloader script to supposedly make the page content compatible with the NetScape browser. The idea is that on detection of NetScape it reloads the page with certain size limitations and, well, you get the idea.

The good news is, it doesn't work very well !

This is due to NetScape's buggy interpretation of specified table sizes (among other elements) and their realtive position on your pages.

You can use my script alongside yours; beneath it actually.

Just put a couple of hard returns below the closing </script> tag of your code, then paste mine in between that closing </script> tag and the closing </head> tag.

No refunds if it doesn't work mind...

;o)

Seriously, I've just checked it and it works fine.

T

  DoctorButcher 19:10 03 Nov 2003

Darn...

Didn't work for me... :(

*sob*

  Taran 19:57 03 Nov 2003

Copy this into the source of your page, but make sure it goes in before the closing </head> tag and not after it:

<script language="JavaScript" type="text/JavaScript"><!-- function MM_reloadPage(init) { //reloads the window if Nav4 resized if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }} else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload(); } MM_reloadPage(true); //--></script>

<script language="JavaScript1.2">

<!--

top.window.moveTo(0,0); if (document.all) { top.window.resizeTo(screen.availWidth,screen.availHeight); } 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; } }

//--> </script>

  Taran 20:02 03 Nov 2003

This should be pasted over the code you posted above.

Where you see this on your current page code:

--></script>

put 2 hard returns AFTER this tag, then paste my script in, making sure all JavaScripts are placed BEFORE the </head> tag on the page.

T

  DoctorButcher 20:29 03 Nov 2003

*sob*

It seems to be stuck at 1024x768!! It isn't working for me, Taran.

All my monitors at home are set for 1152x864 but on displaying the page it reverts back to 1024x768 :(

Looks like i'm going to have to recode the page for 800x600 as that is the most common resolution used by club members.

Cheers anyway for all the help,
Brian

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

Elsewhere on IDG sites

Moto G6 Play Review: First Look

iPad 9.7in (2018) review

Comment utiliser Live Photos ?