473,779 Members | 1,884 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 16089
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
1934
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
1653
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 it's already been decoded. Is there anyway to tell perl to turn a string with bytes in it that look
5
3794
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
3553
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 trying to deceive the spiders, I guarantee you will succeed in increasing your placement in the...
2
9017
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
4082
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
4681
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
13106
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
2284
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
4874
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
9471
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10302
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10071
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8958
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7478
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6723
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5501
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4036
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

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.