Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to cancel auto-refresh?

Status
Not open for further replies.

redss

Programmer
Oct 20, 2002
195
I have a webpage that refreshes every minute using the tag
<meta http-equiv="refresh" content="60">

I want button or link that the user can click to cancel the page from auto-refreshing.

Any ideas on how to do that? Perhaps javascript using the onbeforeunload event?
 
Instead of <meta http-equiv="refresh" content="60"> you could use setInterval and clearInterval together with location.reload.

vlad
 
Ok I'll try that. Question: if I have the browser refresh every minute with setInterval("callreload()",60000) then how do I cancel that?
Thanks!
 
you would need to store the interval's identifier, then clear it.

Code:
// sets the interval
var intId = setInterval("callreload()", 60000);

// clears the interval
clearInterval( intId );



*cLFlaVA
----------------------------
[tt]( <P> <B>)[sup]13[/sup] * (<P> <.</B>)[/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
that works great, thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top