PDA

View Full Version : Netscape 4.x resize problem


vladanik
03-22-2003, 03:07 AM
I have a question about the famous NN 4.x resize problem.

I've been doing a lot of searching on the subject and here's what I found out:

1) Resizing of NN 4 sometimes messes up the layout
of the page - this one is OK

2) NN 4.x interprets every page load as a resize - this one is not OK

I tried doing this:

<script language="JavaScript">
<!--
function radi() {
window.location.reload();
}
//-->
</script>

<body onresize="radi()">

If that was true, then this script should have put NN
into endless looping, which didn't happen, neither
in NN 4.03 nor in NN 4.5

3) On this page http://www.webreference.com/dhtml/diner/resize/resize1.html
it said that NN doesn't triger a resize event when it loads
a page, but when it shows scrollbars. I can not find some confirmation or proof,
for that one either.

They even have an example page at http://www.webreference.com/dhtml/diner/resize/resize2.html
but when I tried their examples in both NN 4.03 and NN 4.5
they didn't work like they said it would. NNs didn't triger
an onresize event when they showed the scrollbars.

Does NN 4.x really triger a resize event when it loads a page or
does it trigger a resize event when it shows scrollbars?
If it's the first case, is there something wrong with my script above?
Why doesn't it work on my machine?

Are the examples on the webreference pages working to you
like they're supposed to, are they trigering the resize event
when the scrollbars are shown?

Could someone please help me with this. I'm desperate. I'm even starting
to think there is no NN 4.x bug :))

Skyzyx
03-22-2003, 05:11 AM
As far as I've read about this bug, articles have always said "in some versions of Netscape 4.x..."

Translated: This bug is fixed in some versions and broken in others.

Actually, I believe it was a bug, then it was fixed, then it was a bug again, then it was fixed again.

Spookster
03-22-2003, 05:29 AM
NS4 IS a bug. :)

brothercake
03-22-2003, 03:59 PM
Originally posted by Spookster
NS4 IS a bug. :)

Indeed :D The bottom line is this:

There is a bug in all versions of netscape 4 where, if you resize a window containing absolutely-positioned layers, they all screw up horribly.

You have to resize/reload to get round this, but there's another bug- I forget the precise details of what handler triggers what other handler - but what happens is that (window.onresize = new Function("window.location.reload()") creates an infinite reload-loop; you can get past it with a time-delayed reload.

I can give details if you want, but it's rather like asking how to make a Ford Edsel run on unleaded - the real answer is "get another car" :p

In other words - if you never use absolutely-positioned layers or inline styles in netscape 4, the problem will never come up.

vladanik
03-22-2003, 04:50 PM
You have to resize/reload to get round this, but there's another bug- I forget the precise details of what handler triggers what other handler - but what happens is that (window.onresize = new Function("window.location.reload()") creates an infinite reload-loop; you can get past it with a time-delayed reload.

I've tried that one in NN 4.03 and NN 4.5 but I didn't get an infinite loop. Maybe there is no bug in these versions that I have?

I can give details if you want, but it's rather like asking how to make a Ford Edsel run on unleaded - the real answer is "get another car". In other words - if you never use absolutely-positioned layers or inline styles in netscape 4, the problem will never come up.

Could you please give me the details. I need to make stuff work in NN 4.x too. There is a relatively high percentage od NN 4.x users in my country.

brothercake
03-22-2003, 05:32 PM
Yeah ... but making it work in netscape 4 is not the same as providing rich content - eye candy, dynamic styles et al. I believe you should specifically not do that. Treat netscape 4 like netscape 3, using style rules to give it a plain, simple, but nonetheless equally informative and navigable website. In other words, I would never dream of saying to someone "please upgrade your browser", but nonetheless, if you use netscape 4 you must expect significantly less advanced functionality and design.

But I can see i'm not gonna persuade you in an afternoon, so I'll get back to your question :) check out http://www.brothercake.com/scripts/resize.php - it's a resize/reload routine that incorporate a delay-timer so as to avoid this problem in ns4.

vladanik
03-23-2003, 12:17 AM
10x brothercake, but do you perhaps know
why I'm not getting an endless loop in
NN 4.03 and NN 4.5 with the code you wrote:

window.onresize = new Function("window.location.reload()")

cheesebagpipe
03-23-2003, 12:21 AM
http://www.webreference.com/dhtml/diner/resize/

Spookster
03-23-2003, 12:37 AM
This is the one that Macromedia Dreamweaver inserts into your code to fix the NS resize bug:


<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>

brothercake
03-23-2003, 12:39 AM
Originally posted by vladanik
why I'm not getting an endless loop in
NN 4.03 and NN 4.5

You want to know why you're not getting a bug in netscape 4? lol :) I've never heard that one before ...

Er ... are you using a mac? It doesn't happen in mac/netscape 4.

vladanik
03-23-2003, 07:57 PM
You want to know why you're not getting a bug in netscape 4? lol I've never heard that one before ...

No, I'm using Windows 98. Maybe I should get another version of NN 4. Maybe I'll see the bug in action there. I can't believe that I have 2 versions without a bug.

Spookster
03-23-2003, 10:05 PM
Maybe NS4 is a stealth bug

brothercake
03-23-2003, 10:06 PM
Originally posted by Spookster
Maybe NS4 is a stealth bug
Or maybe a will-o-the-wisp bug - it's only there when you're not looking at it :D

Roy Sinclair
03-24-2003, 04:09 PM
Netscape 4.05 is the buggy version I ran into that particular problem with. The secret of dealing with that bug is hidden in the code posted above. You save the original height and width of the window into a pair of global variables and then when the resize event occurs you simply check and ignore the resize event if the "new" width and height are the same as the original.

The "looping" is caused by doing a page reload on a page resize without checking for the bug, since the browser with the bug always sends the event as the page loads...

PS. I usually call it Netscum, Netscam or Netscat depending on how much work the latest change I've had to make to accomodate some bug or lack in the browser. Of course IE is short for Internet Exploder but that's a name that the IE team itself came up with and used for an April Fools page a few years ago.