JS: cancel a pending page REFRESH if viewer types in TEXTAREA field

We have the following header refresh to auto-refresh after 10 minutes,

<meta http-equiv="refresh" content="600" />

but we want to cancel that refresh if focus (click into) is set to the main textarea on the page (thus a refresh would not seemingly asynchronously foil the viewer's in-progress typing into the textarea prior to SUBMITting).

1.  Is there a JS way to undo the header tag?
2. (if not) is there an alternate way to set a countdown in JS that refreshes on timeout, and thus clicking into the textarea could cancel that countdown somehow
Who is Participating?
R-ByterConnect With a Mentor Commented:
Remove that meta refresh line from the html and put this code inside <head> tags:

<script type="text/javascript">
var timer;
function sto(){
     timer = setTimeout("RefreshPage()",3000);
function RefreshPage() {
     window.location = "link to your page";
function cto() {

Open in new window

Then put this at your textarea for example:

<textarea name="ta1" id="ta1" cols="10" rows="5" onfocus="RefreshPage()"></textarea>

Open in new window

willsherwoodAuthor Commented:
i think this is what i need.  super!
one clarification:    in order to stop the refreshing once focus was there,  i think in the textarea  i would want   a call to cto() .   does that make sense to use  cto() instead of  RefreshPage() ?

Yup, my mistake on that line, you noticed it well. Thanks for the points.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.