Autorefresh a page after x seconds.

U

UJ

Could somebody post code to make a page reload itself after x seconds? I
know it needs to be done in Javascript just don't know how to do it.

TIA
 
B

Brock Allen

Put this in the <head>:

<META HTTP-EQUIV="Refresh" CONTENT="300">

Content is the number of seconds.
 
C

Curt_C [MVP]

UJ said:
Could somebody post code to make a page reload itself after x seconds? I
know it needs to be done in Javascript just don't know how to do it.

TIA

look at META REFRESH for this.
 
R

Rick

In your page load event try this:

context.Response.AppendHeader("Refresh", "60") 'units are seconds

Or the Javascript way:

Dim sScript As String
sScript = "<script language='javascript'>"
sScript += "setInterval('location.reload();',"6000");" 'units are
milliseconds
sScript += "</script>"
If Not Page.IsClientScriptBlockRegistered("refreshscript") Then
Page.RegisterClientScriptBlock("refreshscript", sScript)
End If
 

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,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top