Autorefresh a page after x seconds.

Discussion in 'ASP .Net' started by UJ, Aug 11, 2005.

  1. UJ

    UJ Guest

    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
     
    UJ, Aug 11, 2005
    #1
    1. Advertising

  2. UJ

    Brock Allen Guest

    Put this in the <head>:

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

    Content is the number of seconds.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > 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
    >
     
    Brock Allen, Aug 11, 2005
    #2
    1. Advertising

  3. UJ

    Curt_C [MVP] Guest

    UJ wrote:
    > 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.

    --
    Curt Christianson
    site: http://www.darkfalz.com
    blog: http://blog.darkfalz.com
     
    Curt_C [MVP], Aug 11, 2005
    #3
  4. <html>
    <head>
    <title>WebForm1</title>
    <meta HTTP-EQUIV="Refresh" url="http://10.25.0.147" CONTENT="240">
    </head>
    <body></body>
    </html>
     
    =?Utf-8?B?TWFoaQ==?=, Aug 11, 2005
    #4
  5. UJ

    Rick Guest

    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

    "UJ" <> wrote in message
    news:...
    > 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
    >
    >
     
    Rick, Aug 11, 2005
    #5
  6. UJ

    UJ Guest

    Thanks everybody. I did get it to work using Javascript.


    "Rick" <> wrote in message
    news:...
    >
    > 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
    >
    > "UJ" <> wrote in message
    > news:...
    >> 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
    >>
    >>

    >
    >
     
    UJ, Aug 12, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vbGansta

    Smart Nav and AutoRefresh Problem

    vbGansta, Apr 27, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    1,086
    vbGansta
    Apr 27, 2004
  2. =?Utf-8?B?RWR3YXJk?=

    Autorefresh page at client

    =?Utf-8?B?RWR3YXJk?=, Sep 18, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    834
    =?Utf-8?B?RWR3YXJk?=
    Sep 29, 2005
  3. =?Utf-8?B?VG9t?=

    autorefresh panel on web form

    =?Utf-8?B?VG9t?=, Feb 28, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    347
    Mark Fitzpatrick
    Feb 28, 2007
  4. Ariel

    Autorefresh ASP page help!!

    Ariel, Feb 25, 2004, in forum: ASP General
    Replies:
    2
    Views:
    160
    Ariel
    Feb 27, 2004
  5. Michael Tan
    Replies:
    32
    Views:
    1,073
    Ara.T.Howard
    Jul 21, 2005
Loading...

Share This Page