Notices

Great community. Great ideas.

Welcome to ASP/Free, a community dedicated to helping beginners and professionals alike in improving their knowledge of Microsoft's development and administration technologies. Sign up today to gain access to the combined insight of tens of thousands of members.

Thread: Redirect to another page after 10 seconds

Results 1 to 8 of 8
Share This Thread →
  1. #1
    amasmm is offline Contributing User
    Join Date
    Feb 2005
    Posts
    91
    Rep Power
    10

    Redirect to another page after 10 seconds

    hi there ...
    I want my page to redirect to another page by using response.redirect method ... but I want the redirection to be done after 10 seconds ... any help?

  2. #2
    barneybabe's Avatar
    barneybabe is offline Contributing User
    Join Date
    Jun 2004
    Posts
    1,657
    Rep Power
    237
    You can try the following script to do auto redirecting but it is not using asp. If you wish you can make use of this code.

    Code:
    <HTML><HEAD>
    
    <!-- Begin ReDirect Command -->
    <!-- Re-Direct Page JavaScript Code -->
    <meta http-equiv="refresh" content="10;url=http://www.abcxyz.com">
    <!-- End ReDirect Command -->
    
    </head>
    <BODY BGCOLOR="#ffffff">
    <div align="center">
    <center><table border="0" width="290" height="156"><tr><td width="65%"></td><td width="35%"><p align="center"><font face="ms sans serif" size="4" color="#000000"><b>Your Code<br>Demonstration</b></font><br><input TYPE="button" VALUE="Close" onClick="window.close()"></td></tr></table></center>
    </div>
    </BODY>
    </HTML>

  3. #3
    arunks's Avatar
    arunks is offline creepy-crawly explorer
    Join Date
    Apr 2005
    Location
    India
    Posts
    132
    Rep Power
    9

    Red face

    This Function can also be called in the ASP part for page redirection., (2*1000 = 2 seconds)

    Code:
    function doRedirect()
    {
        setTimeout( "window.location.href = sTargetURL", 2*1000 );
    }

  4. #4
    amasmm is offline Contributing User
    Join Date
    Feb 2005
    Posts
    91
    Rep Power
    10
    Can you give me an example where this function is used ... thanks

  5. #5
    barneybabe's Avatar
    barneybabe is offline Contributing User
    Join Date
    Jun 2004
    Posts
    1,657
    Rep Power
    237
    You can use this function in OnLoad event of Body tag

    Code:
    <html>
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Auto Redirect</title>
    
    <script language =javascript >
    function doRedirect()
    {
        setTimeout( "window.location.href = 'http://www.abcxyz.com'", 2*1000 );
    }
    </script>
    
    </head>
    
    <body onload="doRedirect()">
    Hello
    </body>
    
    </html>

  6. #6
    Olórin's Avatar
    Olórin is offline Forever Learning User
    Join Date
    Mar 2005
    Location
    Arda
    Posts
    659
    Rep Power
    78
    Here is one you can use. It is all Javascript but has a nice little count down to show the user they are about to be redirected.
    Code:
    <html>
    <head>
    <title></title>
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    
      var start=new Date();
      start=Date.parse(start)/1000;
      var counts=45;
      function CountDown(){
        var now=new Date();
        now=Date.parse(now)/1000;
        var x=parseInt(counts-(now-start),10);
        if(document.form1){document.form1.clock.value = x;}
        if(x>0){
          timerID=setTimeout("CountDown()", 100)
        }else{
          location.href="http://www.vaasinc.com"
        }
      }
    
    //  End -->
    </script>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
      window.setTimeout('CountDown()',100);
    -->
    </script>
    
    </head>
    <body>
    <table border="0" width="750" cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolor="#111111">
    <tr>
      <td width="643" style="color: #000000; font-family: Arial; font-size: 10pt" bgcolor="#FFFFFF" valign="top">
        <p align="center">
        <FORM NAME="form1">
          <p align="center">
          You will be redirected in 
          <INPUT TYPE="text" NAME="clock" SIZE="1" VALUE="10" style="color: #FF0000; font-size: 10pt; font-weight: bold; text-align: center"> seconds.
          </p>
        </FORM>
      </td>
    </tr>
    </table>
    </body>
    </html>
    Change the variable counts to whatever interval you need. Then change "location.href=" to whatever address/page you want them to go to.

    Hope this fits the need.

    - Olórin

  7. #7
    Dwarf's Avatar
    Dwarf is offline Contributing User
    Join Date
    Aug 2005
    Location
    Moscow, Russia
    Posts
    327
    Rep Power
    21
    Code:
    <%
    Response.AddHeader "Refresh", "10;url=http://aspfree.com/"
    %>

  8. #8
    amasmm is offline Contributing User
    Join Date
    Feb 2005
    Posts
    91
    Rep Power
    10
    Thank you guys for your help

Share This Thread →

Become Part of This Conversation

Join NowFor Free!

Similar Threads

  1. Redirect to a Web Page if Logged On
    By kmuel in forum ASP Development
    Replies: 3
    Last Post: July 24th, 2005, 02:25 PM
  2. aspx page does not redirect to URL when tested on server
    By ikiloh in forum .NET Development
    Replies: 0
    Last Post: May 16th, 2005, 04:34 PM
  3. Redisplay page without redirect
    By mowali in forum .NET Development
    Replies: 1
    Last Post: February 9th, 2005, 11:51 PM
  4. asp page does not work to send receipt to customer
    By njlech in forum ASP Development
    Replies: 4
    Last Post: September 22nd, 2004, 03:27 PM
  5. Replies: 1
    Last Post: December 6th, 2000, 03:58 AM

ASP Free Advertisers and Affiliates