/    Sign up×
Community /Pin to ProfileBookmark

what does this code do?

Hi, I added this code into my website a while back but I have forgotten what it does and can’t seem to figure it out. Could someone please tell me what it does? Thanks.

[CODE]<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>
[/CODE]

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceJul 09.2006 — function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true)
with (navigator) {
if ((appName=="Netscape")&amp;&amp;(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);

That code is all for NS4, only. It automatically executes itself during page load and, if NS4, again each time the window is resized. On initial execution, if NS4, it saves the dimensions of the window as new custom properties of the [B]document[/B] object. For each subsequent execution (which won't happen at all if not NS4), it compares the values of these custom properties with the current dimensions of the window. If not equal, the code forces a reload of the page from local cache.

The purpose of this was that NS4 did not automatically re-render a document when the window was resized.
×

Success!

Help @bmass spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...