Truemag

  • Categories
    • Tips And Tricks
    • Internet
    • PHP
    • Javascript
    • CSharp
    • SQL Server
    • Linux
  • Lastest Videos
  • Our Demos
  • About
  • Contact
  • Home
  • Write With Us
  • Job Request
Home Tips And Tricks Create Auto Refresh Page Or Redirect After A Given Seconds

Create Auto Refresh Page Or Redirect After A Given Seconds

Simply add a HTML meta between and to automatically refresh the current page or redirect to another website url after a given seconds.

1. HTML Meta Auto Refresh

Auto refresh the current page after 60 seconds (1 minute):

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

2. HTML Meta Auto Redirect

Auto redirect to http://4rapiddev.com after 5 seconds:

<meta http-equiv="refresh" content="5; http://4rapiddev.com" />

3. Example

An aspx source file below will display current time and it will be updated after 5 seconds:

+ aspx file:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="auto-refresh-page-after-a-given-seconds.aspx.cs" Inherits="auto_refresh_page_after_a_given_seconds" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Demo Automatically Refresh Current Page After 5 Seconds</title>
    <meta http-equiv="refresh" content="5" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
    Current Time: <asp:Label runat="server" ID="lblCurrentTime" ForeColor="Blue"></asp:Label>
    </div>
    </form>
</body>
</html>

+ aspx.cs file:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
public partial class auto_refresh_page_after_a_given_seconds : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        lblCurrentTime.Text = DateTime.Now.ToLongTimeString();
    }
}
Mar 22, 2012 Hoan Huynh

Source Code Demo page

JQuery How to use DatePickerHTTP/ HTTPS Document, CGI-BIN And Access/ Error Logs On cPanel, Plesk And VirtualMin
You Might Also Like:
  • Create Count Down Download Page With JavaScript
  • Auto Rotate Web Page Title With JavaScript
  • Auto Convert Text To URL Link And MailTo Email Address With ASP.NET C#
  • C# Save Web Page URL To Image
  • PHP auto post tweet to Twitter
  • Create A New Template For WordPress Page
  • Create Custom Update Profile Page For WordPress Users
  • How To Ask People To Like Your Facebook Page On The Landing Page
  • Disable Auto Save Password In HTML Form Or TextBox
  • Show Error Message On WordPress Custom Login Template Page
Hoan Huynh

Hoan Huynh is the founder and head of 4rapiddev.com. Reach him at hoan@4rapiddev.com

7 years ago Tips And TricksHTML, http-equiv, refresh, ToLongTimeString145
0
GooglePlus
0
Facebook
0
Twitter
0
Digg
0
Delicious
0
Stumbleupon
0
Linkedin
0
Pinterest
Most Viewed
PHP Download Image Or File From URL
18,697 views
Notepad Plus Plus Compare Plugin
How To Install Compare Text Plugin In Notepad Plus Plus
14,446 views
Microsoft SQL Server 2008 Attach Remove Log
Delete, Shrink, Eliminate Transaction Log .LDF File
13,326 views
JQuery Allow only numeric characters or only alphabet characters in textbox
10,871 views
C# Read Json From URL And Parse/Deserialize Json
7,461 views
4 Rapid Development is a central page that is targeted at newbie and professional programmers, database administrators, system admin, web masters and bloggers.
Recent Posts
  • Magento Fatal error: Unsupported operand types
  • Ionic bower the name contains uppercase letters
  • PHP Magento Get Manufacturer Name And ID From Magento Product ID
  • Know Simple Hacks To Systematize Media Library in WordPress
  • A handy guideline on adding custom menu item in WordPress admin
Categories
  • CSharp (45)
  • Facebook Graph API (19)
  • Google API (7)
  • Internet (87)
  • iPhone XCode (8)
  • Javascript (35)
  • Linux (26)
  • MySQL (16)
  • PHP (84)
  • Problem Issue Error (29)
  • Resources (32)
  • SQL Server (25)
  • Timeline (5)
  • Tips And Tricks (140)
EMAIL SUBSCRIPTION

Sign up for our newsletter to receive the latest news and event postings.

Recommended
  • CDN
  • Hosting
  • Premium Themes
  • VPS
2014 © 4 Rapid Development