473,581 Members | 2,877 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to turn off meta-refresh ?

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>Ent er your new message:
<br><textarea NAME=NewMsg rows=2 cols=60 wrap=virtual
onClick="window .location.reloa d(false);"></textarea>
<br><input TYPE=submit value="Post Your Message" >

but this actually forces a refresh onClick ?!

dan
Jul 20 '05 #1
43 16030
dan baker wrote:
[...]
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.setTimeo ut(...) call and cancel the timeout when necessary:

if (window.setTime out)
var iTimeout =
window.setTimeo ut('if (location.reloa d) location.reload ();', 42);
....
<... onclick="if (window.clearTi meout) window.clearTim eout(iTimeout) // one
line recommended">.. .</...>
I've tried:
<p class=small>Ent er your new message:
<br><textarea NAME=NewMsg rows=2 cols=60 wrap=virtual
onClick="window .location.reloa d(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/...n.html#1194198
PointedEars

Jul 20 '05 #2
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>Ent er your new message:
<br><textarea NAME=NewMsg rows=2 cols=60 wrap=virtual
onClick="window .location.reloa d(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 ().

Jul 20 '05 #3
bo*****@yahoo.c om (dan baker) wrote in message news:<13******* *************** ****@posting.go ogle.com>...
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="JavaS cript1.1">
<!-- hide script from old browsers...

// always start auto-refresh onLoad
var RefreshID = setInterval("wi ndow.location.r eload()",10000) ;

function StopRefresh(){
clearInterval(R efreshID);
}

function RestartRefresh( ){
RefreshID = setInterval("wi ndow.location.r eload()",10000) ;
}

// -->
</SCRIPT>

<td>
<a name=bottom></a>
<textarea NAME=NewMsg rows=2 cols=60 wrap=virtual
onFocus="StopRe fresh();return true;"></textarea>
<br><input TYPE=submit value="Post Your Message" >
</td>
thanks again.... d
Jul 20 '05 #4
dan baker wrote:
bo*****@yahoo.c om (dan baker) wrote in message
news:<13******* *************** ****@posting.go ogle.com>...
Please shorten this to an attribution _line_.
<SCRIPT LANGUAGE="JavaS cript1.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("wi ndow.location.r eload()",10000) ;

function StopRefresh(){
clearInterval(R efreshID);
}

function RestartRefresh( ){
RefreshID = setInterval("wi ndow.location.r eload()",10000) ;
}

// -->
</SCRIPT>

[...]
<textarea NAME=NewMsg rows=2 cols=60 wrap=virtual
onFocus="StopRe fresh();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.setInter val(...) 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="JavaS cript">
<!--
function stopRefresh()
{
if (window.myRefre sh /* global variables are properties of the
container object; no property, no
clearing necessary */
&& window.clearTim eout)
window.clearTim eout(myRefresh) ;
}

function startRefresh()
{
if (window.setTime out && window.location && window.location .reload)
myRefresh = window.setTimeo ut("window.loca tion.reload()", 10000);
}
//-->
</script>
...
</head>

<body>
<form>
...
<textarea name="NewMsg" rows="2" cols="60" wrap="virtual"
onfocus="stopRe fresh();" onblur="startRe fresh();"></textarea>
...
</form>
<script type="text/javascript" language="JavaS cript">
<!--
/*
* 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

Jul 20 '05 #5
On Thu, 16 Oct 2003 01:48:28 +0200, Thomas 'PointedEars' Lahn
<Po*********@we b.de> wrote:
dan baker wrote:
<SCRIPT LANGUAGE="JavaS cript1.1">
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.setInter val(...) 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.myRefre sh /* 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.
--
comp.lang.javas cript FAQ - http://jibbering.com/faq/

Jul 20 '05 #6
ji*@jibbering.c om (Jim Ley) writes:
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.netscap e.com/library/manuals/2000/javascript/1.3/reference/window.html>

This (Javascript 1.3) specification states that the object "window"
has the method "setInterva l". I.e., "setInterva l" 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 "setInterva l"
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
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #7
On 16 Oct 2003 14:08:36 +0200, Lasse Reichstein Nielsen
<lr*@hotpop.com > wrote:
ji*@jibbering. com (Jim Ley) writes:
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.


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


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.
--
comp.lang.javas cript FAQ - http://jibbering.com/faq/

Jul 20 '05 #8
ji*@jibbering.c om (Jim Ley) writes:
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
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #9
On 16 Oct 2003 15:01:34 +0200, Lasse Reichstein Nielsen
<lr*@hotpop.com > wrote:
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.
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? :)


The last two yes. ASV6 even renders some HTML.

Jim.
--
comp.lang.javas cript FAQ - http://jibbering.com/faq/

Jul 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1928
by: Du | last post by:
I got this error while trying to open an url // URL file-access is disabled in the server configuration how do I turn that directive on? I don't have access to the php nor apache ini file thanks
0
1644
by: Donald Gordon | last post by:
Hi I'm trying to retrieve an HTML document in UTF-8 format using LWP, but have hit a snag: the document redefines the Content-type: header from "text/html" to "text/html; charset=UTF-8" using a <meta http-equiv="Content-type"... /> tag. LWP doesn't pick this up, and I seem to be ending up with a string with UTF-8 in it, but perl thinks...
5
3774
by: Donald Firesmith | last post by:
Are html tags allowed within meta tags? Specifically, if I have html tags within a <definition> tag within XML, can I use the definition as the content within the <meta content="description> tag? If not, is there an easy way to strip the html tags from the <definition> content before inserting the content into the meta tag?
24
3532
by: Day Bird Loft | last post by:
Web Authoring | Meta-Tags The first thing to understand in regard to Meta Tags is the three most important tags placed in the head of your html documents. They are the title, description, and keyword meta-tags. If you are missing any of these meta-tags you are missing the boat. If you use the following meta-tag formula, and you are not...
2
8994
by: scorp7355 | last post by:
I was wondering if there is some other way to turn autocomplete off besides using "autocomplete=off", using a meta tag or something similar. It would be great if there is some way to turn it off at a page level. Any ideas/thought would be greatly appreciated. Thanks in advance, Zac
21
4055
by: Jon Slaughter | last post by:
I have a class that is basicaly duplicated throughout several files with only members names changing according to the class name yet with virtually the exact same coding going on. e.g. class A { std::vector<B*> Bs; public:
4
4677
by: Robert Strickland | last post by:
I wish to turn off browser caching through some meta tags. Note the following: <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <META HTTP-EQUIV="Expires" CONTENT="-1"> <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"> However, running against my local site, the browser still caches the page and it's contents. What am I missing?
19
13085
by: IveCal | last post by:
Hello, I have this code which redirects to http://www.domain.com/link.html . . . but I want to specify the NUMBER OF SECONDS before the site is redirected. Can somebody here help me . . .. <meta http-equiv="Refresh" content="4;url=http://www.domain.com/link.html"> PLEASE HELP. Thanks.
8
2277
by: Jon Rea | last post by:
http://osl.iu.edu/~tveldhui/papers/Template-Metaprograms/meta-art.html Can anyone shed some light on the need for stuff like this when using any of the most modern compilers? If i have a function : double Square( double d ) { return d * d;
4
4854
by: coderr | last post by:
Hi all, i have simple question, suppose that we have a ASP.NET web site with lots of local resource files, we can simple delete all of the resource files (resx). Question is, how can remove all of the meta keys like meta:resourcekey="blabla". Is there a simple way? (like replace all) regards
0
7882
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7914
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8181
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6564
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5683
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5366
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2309
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1145
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.