how to turn off meta-refresh ?

D

dan baker

I have a page that gets loaded with a meta-refresh hardcoded so that a
few things on the page get updated. its kind of a fake chat board.
anyway, what I need to do is turn off the meta-refresh once someone
clicks in a <textarea> to enter their input; otherwise the refresh
catches them in the middle and messes up the focus.

I need a way to turn off the meta-refresh, or to force the
cursor/focus to stay in the message input box once they click in it
and start typing.

I've tried:
<p class=small>Enter your new message:
<br><textarea NAME=NewMsg rows=2 cols=60 wrap=virtual
onClick="window.location.reload(false);"></textarea>
<br><input TYPE=submit value="Post Your Message" >

but this actually forces a refresh onClick ?!

dan
 
L

Lee

dan baker said:
I have a page that gets loaded with a meta-refresh hardcoded so that a
few things on the page get updated. its kind of a fake chat board.
anyway, what I need to do is turn off the meta-refresh once someone
clicks in a <textarea> to enter their input; otherwise the refresh
catches them in the middle and messes up the focus.

I need a way to turn off the meta-refresh, or to force the
cursor/focus to stay in the message input box once they click in it
and start typing.

I've tried:
<p class=small>Enter your new message:
<br><textarea NAME=NewMsg rows=2 cols=60 wrap=virtual
onClick="window.location.reload(false);"></textarea>
<br><input TYPE=submit value="Post Your Message" >

but this actually forces a refresh onClick ?!

That's right. The "reload()" method does cause the window to
reload immediately. The "false" argument simply means that you
don't want to force a new download if the page is already in
your cache.

Guessing won't get you very far. Find a book or some of the
on-line resources listed in the FAQ.

I don't believe there is any way in JavaScript to disable the
REFRESH directive. Since your page seems to rely on Javascript,
anyway, you would be better off not using the HTTP REFRESH
directive, but using JavaScript to refresh the page periodically.

Look into setInterval(), clearInterval(), and, of course,
location.reload().
 
T

Thomas 'PointedEars' Lahn

dan said:
[...]
anyway, what I need to do is turn off the meta-refresh once someone
clicks in a <textarea> to enter their input; [...]

You cannot cancel what has been parsed before, but you can cancel what
you have set before with JavaScript, so change the meta-refresh into a
window.setTimeout(...) call and cancel the timeout when necessary:

if (window.setTimeout)
var iTimeout =
window.setTimeout('if (location.reload) location.reload();', 42);
....
<... onclick="if (window.clearTimeout) window.clearTimeout(iTimeout) // one
line recommended">... said:
I've tried:
<p class=small>Enter your new message:
<br><textarea NAME=NewMsg rows=2 cols=60 wrap=virtual
onClick="window.location.reload(false);"></textarea>
<br><input TYPE=submit value="Post Your Message" >

but this actually forces a refresh onClick ?!

BAD. Broken as designed. See
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/location.html#1194198


PointedEars
 
D

dan baker

I have a page that gets loaded with a meta-refresh hardcoded so that a
few things on the page get updated. its kind of a fake chat board.
anyway, what I need to do is turn off the meta-refresh once someone
clicks in a <textarea> to enter their input; otherwise the refresh
catches them in the middle and messes up the focus.
--------------------

thanks for the help people... I did more reading and found an even
slicker way to do it with setInterval(). The basic sticking point that
you solved for me was that the refresh had to be started with
javascript rather than coming in hardcoded. Anyway, I thought I would
post the snippet in case someone else needs it:

<SCRIPT LANGUAGE="JavaScript1.1">
<!-- hide script from old browsers...

// always start auto-refresh onLoad
var RefreshID = setInterval("window.location.reload()",10000);

function StopRefresh(){
clearInterval(RefreshID);
}

function RestartRefresh(){
RefreshID = setInterval("window.location.reload()",10000);
}

// -->
</SCRIPT>

<td>
<a name=bottom></a>
<textarea NAME=NewMsg rows=2 cols=60 wrap=virtual
onFocus="StopRefresh();return true;"></textarea>
<br><input TYPE=submit value="Post Your Message" >
</td>


thanks again.... d
 
T

Thomas 'PointedEars' Lahn

dan said:
(e-mail address removed) (dan baker) wrote in message
news:<[email protected]>...

Please shorten this to an attribution _line_.
<SCRIPT LANGUAGE="JavaScript1.1">

That's invalid HTML, AFAIK only IE for Windows will accept the code. The
`script' element requires a `type' attribute to define the MIME type of
the code. And the `language' attribute is deprecated. If you use it for
backwards compatibility with older user agents, do not specify the version.
<!-- hide script from old browsers...

// always start auto-refresh onLoad
var RefreshID = setInterval("window.location.reload()",10000);

function StopRefresh(){
clearInterval(RefreshID);
}

function RestartRefresh(){
RefreshID = setInterval("window.location.reload()",10000);
}

// -->
</SCRIPT>

[...]
<textarea NAME=NewMsg rows=2 cols=60 wrap=virtual
onFocus="StopRefresh();return true;"></textarea>
[...]

I do not see the point of defining an interval (a *self-repeating* action)
here. A timeout that is cleared when focusing the `textarea' element (and
reset on blur, if you like it) should suffice and is more compatible because
it is supported since JavaScript 1.0, while window.setInterval(...) requires
JavaScript 1.2 support. (I'm aware that recent UAs support at least JS 1.2.)

Also I do not understand why you are defining the global variable at first
(and *before* the document is loaded). To restart the refresh interval
(better: timeout; see above) you define a function that redefines that
variable, why don't you call the function onload? That would simplify
programming and maintenance.

It is good style to reference properties by their object, even if it is not
required with `window', and it is also good style to check properties for
existence before accessing them.

Summary:

<head>
...
<script type="text/javascript" language="JavaScript">
<!--
function stopRefresh()
{
if (window.myRefresh /* global variables are properties of the
container object; no property, no
clearing necessary */
&& window.clearTimeout)
window.clearTimeout(myRefresh);
}

function startRefresh()
{
if (window.setTimeout && window.location && window.location.reload)
myRefresh = window.setTimeout("window.location.reload()", 10000);
}
//-->
</script>
...
</head>

<body>
<form>
...
<textarea name="NewMsg" rows="2" cols="60" wrap="virtual"
onfocus="stopRefresh();" onblur="startRefresh();"></textarea>
...
</form>
<script type="text/javascript" language="JavaScript">
<!--
/*
* Timeout should start when the document has been completely loaded,
* but the `onload' event handler is not supported by all UAs, so we
* place the script at the end of the `body' element.
*/
startRefresh();
//-->
</script>
</body>


PointedEars
 
J

Jim Ley

That's invalid HTML, AFAIK only IE for Windows will accept the code.

No, the vast majority of browsers will, in fact I don't know of any
which won't (either taking it as their default type or understanding
the language attribute) It's not even an IE invention, so I'm not
sure where you got the idea.
The
`script' element requires a `type' attribute to define the MIME type of
the code. And the `language' attribute is deprecated. If you use it for
backwards compatibility with older user agents, do not specify the version.

There's no reason to include it for anyone, you don't get any extra
compatibility with older browsers, other than in IE 4 in a particular
perverse scenario which I don't believe exists.
while window.setInterval(...) requires
JavaScript 1.2 support. (I'm aware that recent UAs support at least JS 1.2.)

setInterval has nothing to do with the javascript level, it's a DOM
object, although in effect "all" UA's less than 5 years old support
it.
if (window.myRefresh /* global variables are properties of the
container object; no property, no
clearing necessary */

There's no requirement that variables be part of a global object
called window, the global object could be called fred, the only UA's I
know which do this are not HTML ones, but I doubt their unique, I also
know of UA's which don't put their global variable as part of the
window object and the above check would fail - I wouldn't recommend
doing it)
* Timeout should start when the document has been completely loaded,
* but the `onload' event handler is not supported by all UAs, so we
* place the script at the end of the `body' element.

Please name such a UA!

Jim.
 
L

Lasse Reichstein Nielsen

setInterval has nothing to do with the javascript level, it's a DOM
object, although in effect "all" UA's less than 5 years old support
it.

Actually, it does. Javascript is a product of Netscape Corp. which is
used in its browsers. Other browsers have also implemented similar
languages under similar names, but the definition of Javascript v1.2
is ... hmm, unavailable. However, they do have 1.3 online, and as part
of that specification, they define the window object:
<URL:http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/window.html>

This (Javascript 1.3) specification states that the object "window"
has the method "setInterval". I.e., "setInterval" is part of
Javascript 1.3.

It makes no sense to talk about Javascript levels apart from
Netscape's specifications. There are similar specifications of
different versions of JScript.
I also know of UA's which don't put their global variable as part of
the window object and the above check would fail - I wouldn't
recommend doing it)

Do you know of *browsers* that don't have a global variable called
"window" that points to the global object (and which support
ECMAScript-like scripting at all)?

I believe that the current draft of the next version of SVG DOM
includes references to the object called "window" with a "setInterval"
method. Can't find a single reference to it right now, though.

What is the UA that has a window object separate from the global object?

/L
 
J

Jim Ley

Actually, it does. Javascript is a product of Netscape Corp. which is
used in its browsers.

No worries, we can see it's gone in JavaScript 1.5 then, so therefore
Mozilla browser's don't support setInterval? That's good to know.

However, I believe you're falling into the trap of confusing the
DOM/script documentation from Netscape which has always confused the
two, that's just a weakness of the documentation.
Do you know of *browsers* that don't have a global variable called
"window" that points to the global object (and which support
ECMAScript-like scripting at all)?

Yes, I've discussed it before, CSV is the most recent one, it's still
a a browser, seen as it's in no standard that the global object is
called window, it seems rather silly to do it such.
What is the UA that has a window object separate
from the global object?

ASV3 and 6 and CSV.

Jim.
 
L

Lasse Reichstein Nielsen

No worries, we can see it's gone in JavaScript 1.5 then, so therefore
Mozilla browser's don't support setInterval? That's good to know.
However, I believe you're falling into the trap of confusing the
DOM/script documentation from Netscape which has always confused the
two, that's just a weakness of the documentation.

I guess it is a matter of wording.
The window object isn't in the Javascript 1.5 *Core* Language.
But, as you say, they are not very explicit about the difference
between the core language and the language included in the browser,
calling both "Javascript".

I will maintain that javascript 1.2 was not defined in terms of Core
language and browser/client extensions, but was seen as a whole.

Terminology has changed since then, with the introduction of the
concept of a DOM. What-is-now-DOM methods such as setInterval, Image,
Option, etc. were then just part of Javascript 1.2.

That means that not only are there changes to the language, there are
also changes to how we think about it. Having two different
perspectives at the same time is bound to give problems. :)
Yes, I've discussed it before, CSV is the most recent one, it's still
a a browser, seen as it's in no standard that the global object is
called window, it seems rather silly to do it such.

I can't find this CSV browser through Google (the most used menaing of
CSV seems to be Comma Separated Values). Even checked all you wrote
about it in this group, but no explaition of CSV except Comma
Separated List..
ASV3 and 6 and CSV.

.... and ASV seems to mean Action Script Viewer (apparently for
Shockwave). Ah, there. It is also Adobe SVG Viewer. That would make
CSV ... Corel SVG Viewer? :)

I'll look into them.
/L
 
J

Jim Ley

I will maintain that javascript 1.2 was not defined in terms of Core
language and browser/client extensions, but was seen as a whole.

We moaning about that though in this list even then... Fortunately
it's not much better.
... and ASV seems to mean Action Script Viewer (apparently for
Shockwave). Ah, there. It is also Adobe SVG Viewer. That would make
CSV ... Corel SVG Viewer? :)

The last two yes. ASV6 even renders some HTML.

Jim.
 
D

dan baker

Thomas 'PointedEars' Lahn said:
It is good style to reference properties by their object, even if it is not
required with `window', and it is also good style to check properties for
existence before accessing them.

Summary:
.................. code

----------------------

thanks for the example. I'm not very experienced with javascript, so
examples and explainations really help. ;)

d
 
T

Thomas 'PointedEars' Lahn

Dr said:
JRS: In article <[email protected]>, seen in
Thomas 'PointedEars' Lahn


You are being silly, IMHO, unless you can provide a reference to a
Usenet Standard that calls for a single line.

Well, it is called attribution _line_ (and not attribution novel) for the
reason that it should only provide information who wrote the quoted text,
especially when there is more than one quoting level. The other information
(like message ID, newsgroup(s) name, the sender's address, posting date and
time) can be easily retrieved via and from the headers of the postings by
people who are interested in it. On the other hand, this overhead is fitted
to make a posting less readable. (The newsgroup name and message ID in this
e-mail is only included to help you find the posting I am referring to,
because this is a different medium and not all e-mail user agents support
showing/clicking headers like `References' or `In-Reply-To'.)

I need not to provide a reference to a Usenet standard that recommends
this (although there may be one) because common sense should be enough to
recognize it, and if you call me silly for merely *asking* for a readable
posting, that is *your* problem.


Please do note that I did not want to discuss there here off-topic in
the first place, but you leave me no choice:

----------------------------------------------------------------------

Your message could not be delivered to the following recipients
(e-mail address removed)



Reporting-MTA: dns; merlyn.demon.co.uk
Received-From-MTA: smtp; lon1-punt3-4.mail.demon.net
Arrival-Date: Thu, 16 Oct 2003 23:38:49 +0100

Final-Recipient: rfc822; (e-mail address removed)
Action: failed
Status: 5.0.0



Return-Path: <[email protected]>
Received: from lon1-punt3-4.mail.demon.net ([194.217.242.167])
by merlyn.demon.co.uk with SMTP id <[email protected]>
for <[email protected]> ; Thu, 16 Oct 2003 23:38:49 +0100
Received: from punt-3.mail.demon.net by mailstore
for (e-mail address removed) id 1AAFNH-0002Mn-EH;
Thu, 16 Oct 2003 21:09:35 +0000
Received: from [217.72.192.151] (helo=smtp.web.de)
by punt-3.mail.demon.net with esmtp id 1AAFNH-0002Mn-EH
for (e-mail address removed); Thu, 16 Oct 2003 21:09:35 +0000
Received: from erf2-d9b98986.pool.mediaways.net ([217.185.137.134] helo=web.de)
by smtp.web.de with asmtp (TLSv1:RC4-MD5:128)
(WEB.DE 4.99 #459)
id 1AAFNG-0001b0-00
for (e-mail address removed); Thu, 16 Oct 2003 23:09:35 +0200
Message-ID: <[email protected]>
Date: Thu, 16 Oct 2003 23:10:23 +0200
From: Thomas 'PointedEars' Lahn <[email protected]>
Reply-To: Thomas 'PointedEars' Lahn <[email protected]>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5)
Gecko/20030925
X-Accept-Language: de-de, de, en
MIME-Version: 1.0
To: Dr John Stockton <[email protected]>
Subject: Re: how to turn off meta-refresh ?
References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
In-Reply-To: <[email protected]>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: (e-mail address removed)

----------------------------------------------------------------------


And my second (and final) attempt resulted in:

----------------------------------------------------------------------

Your message could not be delivered to the following recipients
(e-mail address removed)



Reporting-MTA: dns; merlyn.demon.co.uk
Received-From-MTA: smtp; lon1-punt3-4.mail.demon.net
Arrival-Date: Fri, 17 Oct 2003 23:26:30 +0100

Final-Recipient: rfc822; (e-mail address removed)
Action: failed
Status: 5.0.0



Return-Path: <[email protected]>
Received: from lon1-punt3-4.mail.demon.net ([194.217.242.167])
by merlyn.demon.co.uk with SMTP id <[email protected]>
for <[email protected]> ; Fri, 17 Oct 2003 23:26:30 +0100
Received: from punt-3.mail.demon.net by mailstore
for (e-mail address removed) id 1AAUiU-0002dm-ET;
Fri, 17 Oct 2003 18:00:25 +0000
Received: from [217.72.192.164] (helo=mailgate3.cinetic.de)
by punt-3.mail.demon.net with esmtp id 1AAUiU-0002dm-ET
for (e-mail address removed); Fri, 17 Oct 2003 13:32:30 +0000
Received: from smtp.web.de (fmsmtp03.dlan.cinetic.de [172.20.0.183])
by mailgate3.cinetic.de (8.11.6p2/8.11.2/SuSE Linux 8.11.0-0.4) with ESMTP
id h9HCS3313416
for <[email protected]>; Fri, 17 Oct 2003 14:28:04 +0200
Received: from erf2-d9b989ad.pool.mediaways.net ([217.185.137.173] helo=web.de)
by smtp.web.de with asmtp (TLSv1:RC4-MD5:128)
(WEB.DE 4.99 #459)
id 1AATf9-0004yh-00
for (e-mail address removed); Fri, 17 Oct 2003 14:25:00 +0200
Message-ID: <[email protected]>
Date: Fri, 17 Oct 2003 14:25:28 +0200
From: "Thomas 'PointedEars' Lahn" <[email protected]>
Reply-To: "Thomas 'PointedEars' Lahn" <[email protected]>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5)
Gecko/20030925
X-Accept-Language: de-de, de, en
MIME-Version: 1.0
To: Dr John Stockton <[email protected]>
Subject: Re: how to turn off meta-refresh ?
References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
In-Reply-To: <[email protected]>
Content-Type: multipart/signed; protocol="application/x-pkcs7-signature";
micalg=sha1; boundary="------------ms060801090207040006010505"
Sender: (e-mail address removed)

----------------------------------------------------------------------

You are in fact violating RFCs 1036, 1855 and 2822.

I will be glad if you send me an e-mail and allow me to
provide further explanation of the problems.

Therefore: F'up2 poster, my Reply-To address is (of course)
valid and read regularly.


PointedEars
 
D

Dr John Stockton

JRS: In article <[email protected]>, seen in
Thomas 'PointedEars' Lahn
Well, it is called attribution _line_ (and not attribution novel) for the
reason that it should only provide information who wrote the quoted text,
especially when there is more than one quoting level. The other information
(like message ID, newsgroup(s) name, the sender's address, posting date and
time) can be easily retrieved via and from the headers of the postings by
people who are interested in it.

Evidently you do not understand the full variety of circumstances under
which someone who has a copy of an article can make use of an
informative attribution. Be aware, for example, that someone who has
saved a copy of an article which *quotes* an attribution line has not
saved the header of the attributing article.

Evidently you are unable to provide a reference to a Usenet Standard
calling for single-line attributions.

Please do note that I did not want to discuss there here off-topic in
the first place, but you leave me no choice:

Since you make inappropriate complaint about newsgroup postings, it is
in the newsgroup that you must be shown to be incapable of justifying
your unfounded assertion.
 
T

Thomas 'PointedEars' Lahn

Dr said:
[...]
Evidently you do not understand the full variety of circumstances under
which someone who has a copy of an article can make use of an
informative attribution. Be aware, for example, that someone who has
saved a copy of an article which *quotes* an attribution line has not
saved the header of the attributing article.

Evidently you do not understand what headers are and what their function
is. Most news clients are saving headers with articles (see the .eml format
for example) and one can include the information *when* *required*.

Evidently you do not know of news archives like Google Groups,
where one can (in most cases) re-read whole discussions when a
single message ID or even a keyword has been provided.
Evidently you are unable to provide a reference to a Usenet Standard
calling for single-line attributions.

Evidently you do not understand what a readable posting is, and
that you write for your readers, not for posing yourselves.
Since you make inappropriate complaint about newsgroup postings, it is ^^^^^^^^^^^^^^^^^^^^^^^
in the newsgroup that you must be shown to be incapable of justifying
your unfounded assertion.

It was merely a plea along with an on-topic and (hopefully) a helpful
answer. In contrast, your answers and the subject of my plea are completely
off-topic here.

And evidently you do not even think about paying respect to core Internet
and Usenet standards, namely not using a valid e-mail address (as stated
by RFCs 1036 and 2822), not having installed the `postmaster' account for
your(?) sub-level domain (as stated by RFC 1173), and not obeying the core
rules of Netiquette (RFC 1855), so I do not see the point of discussing
the justification of (my) statements by those standards with you.


EOD

F'up2 PointedEars (again)
 
T

Thomas 'PointedEars' Lahn

Jim said:
No, the vast majority of browsers will,

The vast majority of browser is not all browsers.
Besides, there are user agents other than browsers.
in fact I don't know of any which won't (either taking it as their
default type or understanding the language attribute)
It's not even an IE invention, so I'm not sure where you got the idea.

,--------<http://www.w3.org/TR/html4/interact/scripts.html#h-18.2.1>--------
| language = cdata [CI]
| Deprecated. This attribute specifies the scripting language of the
| contents of this element. Its value is an identifier for the language,
| but since these identifiers are not standard, this attribute has been
| deprecated in favor of type.
There's no reason to include it for anyone,

The reason is that you create valid HTML which causes web pages to stay
functional for the foreseeable future. The trend is that user agents
become more and more standards compliant, so authors are wise to obey
the standards.
setInterval has nothing to do with the javascript level,
s/level/version/

it's a DOM object, although in effect "all" UA's less than 5 years
old support it.

Before the W3C-DOM (October 1998) there was no idea of a DOM, and what we
call host objects of a DOM now were previously part of the core language.

http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/window.html#1203669

(Find the setTimeout(...) method originating from JavaScript 1.0 in the
same document.)

The W3C-DOM Level 2 Candidate Recommendation called that part, supported
by Netscape Navigator 3.0 and Internet Explorer 3.0, "DOM Level 0":

http://www.w3.org/TR/1999/CR-DOM-Level-2-19991210/glossary.html

Namely Netscape Navigator up to version 4.x implemented the next versions
of JavaScript:

http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/preface.html#1003267

With Mozilla/5.0 implementing JavaScript 1.5 (which is based upon
ECMAScript Edition 3), those UA dependent parts have been moved from
the Core Reference to the Gecko DOM Reference:

http://mozilla.org/docs/dom/domref/
if (window.myRefresh /* global variables are properties of the
container object; no property, no
clearing necessary */

There's no requirement that variables be part of a global object
called window, [...] I also know of UA's which don't put their
global variable as part of the window object and the above check
would fail - I wouldn't recommend doing it)

You are right, the proper way is

window.myrefresh = window.setTimeout(...);

adding explicitely a property to the `window' object. Then the property
can be checked for existence so that the timeout is only cleared if one
has been set before.
Please name such a UA!

The `onload' attribute was introduced in HTML 4.01, so
all user agents supporting only HTML 3.2 will ignore it.


PointedEars
 
J

Jim Ley

The vast majority of browser is not all browsers.
Besides, there are user agents other than browsers.

Carry on, tell us one that fail... It's not even invalid HTML.
in fact I don't know of any which won't (either taking it as their
default type or understanding the language attribute)
It's not even an IE invention, so I'm not sure where you got the idea.

,--------<http://www.w3.org/TR/html4/interact/scripts.html#h-18.2.1>--------
| language = cdata [CI]
| Deprecated.

Yes, _deprecated_ not non-standard, it will only not work at all in
non html user agents such as X-Smiles or SVG UA's. Of course then it
would be ignored.
Before the W3C-DOM (October 1998) there was no idea of a DOM, and what we
call host objects of a DOM now were previously part of the core language.

No they weren't Microsoft has always considered them distinct, it was
only Netscape documentation that didn't. If you look at the CLJ FAQ
from July 1998, you'll see that there's a question "What is the DOM"
if it didn't exist until October, they're pretty f'ing prescient.
There's no requirement that variables be part of a global object
called window, [...] I also know of UA's which don't put their
global variable as part of the window object and the above check
would fail - I wouldn't recommend doing it)

You are right, the proper way is

window.myrefresh = window.setTimeout(...);

No, that is not correct, for the same reasons I gave before (window
does not _have_ to be the global object name) however the above is
not equivalent to the previous code (the setTimeout executed
immediately and window.myrefresh containing the returned object.
Unlikely what you want.
The `onload' attribute was introduced in HTML 4.01, so
all user agents supporting only HTML 3.2 will ignore it.

No, Please name such a UA, There are no user agents supporting only
HTML 3.2.

Jim.
 
R

Richard Cornford

Thomas 'PointedEars' Lahn said:
The vast majority of browser is not all browsers.
Besides, there are user agents other than browsers.

As I recall IE is the browser least tolerant of specified language
attributes as - language=JavaScript1.3 - (or greater) will not be loaded
by IE 5.0 (at least), while JScript 5+ actually implements most of the
JavaScript 1.4/5 features.
,----<http://www.w3.org/TR/html4/interact/scripts.html#h-18.2.1>-----
| language = cdata [CI]
| Deprecated. ...

Deprecated? So strictly it is only invalid HTML 4 Strict but still valid
(if not recommended) in looser DTDs.
The reason is that you create valid HTML which causes web pages to stay
functional for the foreseeable future. The trend is that user agents
become more and more standards compliant, so authors are wise to obey
the standards.

I read Jim as saying that there is never a reason for using the language
attribute (and by extension a language version) so his comment has no
baring on the creation of valid Strict HTML 4.

if (window.myRefresh /* global variables are properties of the
container object; no property, no
clearing necessary */

There's no requirement that variables be part of a global object
called window, [...] I also know of UA's which don't put their
global variable as part of the window object and the above check
would fail - I wouldn't recommend doing it)

You are right, the proper way is

window.myrefresh = window.setTimeout(...);

I don't see the point of using references relative to - window - in this
context. The interpreter is going to have to resolve the references to -
window - by traversing the scope chain to the global object, which is
exactly what it would have to do to resolve - myrefresh - or -
setTimeout - if used in isolation. The difference seems just to be that
with the - window - reference a second property look-up is needed on the
object referenced by - window - (assuming the global window property
exists in the environment). If the scope resolution is in question then
that applies equally to - window - as it would for - setTimeout - and
otherwise using - window - imposes a performance penalty without any
reliability gain.
adding explicitely a property to the `window' object. Then the property
can be checked for existence so that the timeout is only cleared if one
has been set before.

A type-converting-to-boolean test on an undeclared global identifier
will produce errors where the same test on the property accessor of a
non-existent global property will not, but typeof tests do not suffer
the same problem so the property accessor syntax is not required when
testing global properties/variables (just potentially useful under some
circumstances).
<snip>

Richard.
 
L

Lasse Reichstein Nielsen

....
It's not even invalid HTML.

But it is invalid HTML *4*, since the required attribute "type" is
omitted. I can't find a reference to the language attribute in HTML
3.2 at all.
No, Please name such a UA, There are no user agents supporting only
HTML 3.2.

I would have thought Netscape 2 or Opera 4 would be worth a try, but both
support the body onload attribute.

/L
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top