Refreshing Page Content Using Meta Tags

We can modify a browser’s behavior using <meta> tags. In this task, you’re going to generate code that has the same effect as hitting the browser’s refresh button. You’ll also see how this same code can force the browser to load another document.

Add a new meta tag with http-equiv attribute and set it equal to refresh,

<html>
<head>
<title>HTML in 10 Simple Steps or Less</title>
<meta name=”keywords” content=“HTML,HTML tutorials, CSS Tutorials” />
<meta name=”description” content=“Free tutorials for beginners” />
<meta name=”author” content=“Kaushal Arwal”>
<meta http-equiv=”refresh” />
</head>
<body>
</body>
</html>

Add the content attribute and set it equal to the number of seconds you want the page to remain static before refreshing

In the below example, the page will refresh after every five seconds

<html>
<head>
<title>HTML in 10 Simple Steps or Less</title>
<meta name=”keywords” content=“HTML,HTML tutorials, CSS Tutorials” />
<meta name=”description” content=“Free tutorials for beginners” />
<meta name=”author” content=“Kaushal Arwal”>
<meta http-equiv=”refresh” content=”5” />
</head>
<body>
</body>
</html>

To force the browser to load another document after the refresh time elapses, follow the refresh rate value with a semicolon and enter url=pathname, where pathname equals the file path to a document on your Web server or a complete URL to a document on another site,

In the below example, the page will refresh after five seconds and redirect to the mentioned URL.

<html>
<head>
<title>HTML in 10 Simple Steps or Less</title>
<meta name=”keywords” content=“HTML,HTML tutorials, CSS Tutorials” />
<meta name=”description” content=“Free tutorials for beginners” />
<meta name=”author” content=“Kaushal Arwal”>
<meta http-equiv=”refresh” content=”5; url=http://www.kaushalstreet.com” />
</head>
<body>
</body>
</html>

For more HTML tutorials, please visit: http://www.kaushalstreet.com/topics/html-tutorials/