Free Web tutorials covering HTML, CSS, JavaScript, and DHTML from beginner to advanced. Free downloads and developer resources. Personalized help via email, form, and chat.

free, web, tutorials, HTML, html, CSS, css, stylesheet, cascading stylesheet, Javascript, javascript, JavaScript, DHTML, dhtml, beginner, advanced, web development, web page, web site, free web tutorial, free HTML tutorial, free CSS tutorial, free css tutorial, free cascading stylesheet tutorial, free stylesheet tutorial, free javascript tutorial, free DHTML tutorial, free HTML class, free CSS class, free stylesheet class, free cascading stylesheet class, free javascript class, free DHTML class">

Free Web tutorials covering HTML, CSS, JavaScript, and DHTML from beginner to advanced. Free downloads and developer resources. Personalized help via email, form, and chat. free, web, tutorials, HTML, html, CSS, css, stylesheet, cascading stylesheet, Javascript, javascript, JavaScript, DHTML, dhtml, beginner, advanced, web development, web page, web site, free web tutorial, free HTML tutorial, free CSS tutorial, free css tutorial, free cascading stylesheet tutorial, free stylesheet tutorial, free javascript tutorial, free DHTML tutorial, free HTML class, free CSS class, free stylesheet class, free cascading stylesheet class, free javascript class, free DHTML class

<Code_Punk>'s

Advanced HTML Lesson 31:
Using <meta> Tags To Load A Page

Code Tutorials



Site Development



Downloads



Help!!



Home

Overview

You can use the <meta> tag to automatically reload a page or to redirect to another page. This comes in very handy if you've moved your site and need to redirect to the new URL. It also comes in handy if you've made a major update and want to insure that your viewers have reloaded the new page from your server as opposed to the old page in their browser's cache.

HTTP-EQUIV

This <meta> tag uses the HTTP-EQUIV attribute instead of NAME:

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

We'll fill in the CONTENT attribute in a minute. For now pay attention to the HTTP-EQUIV attribute. Don't forget the hyphen (-). To automatically reload the current page or load another one, always set HTTP-EQUIV to "refresh". Don't forget the quotes around "refresh".

The CONTENT

The value for the CONTENT attribute has two parts when used with HTTP-EQUIV="refresh". It looks like this:

<meta http-equiv="refresh"
content="10;url=http://www.google.com/">

Notice the CONTENT value above. The whole value is put in double quotes. The first thing coded is a number representing the number of seconds to wait before loading the subsequent URL. The page with this <meta> tag would load and wait 10 seconds before loading the Google homepage. Here's an example.

The number of seconds is followed by a semicolon (;) and "url=". Finally, code in the URL to the page you want loaded.

Notice that there are no quotes used in the URL or anywhere else inside the main double quotes. This is different from coding URLs in other tags. Make note of it.

If the URL used is the same as the page loaded, the page will reload, or "refresh". You can keep reloading the same page at whatever frequency you'd like.

Summary & Exercises

You can automatically reload a page or redirect to another page by using a <meta> tag with HTTP-EQUIV="refresh".

The CONTENT of this tag is coded in two parts, a time (in seconds) to delay, and the URL of the page to redirect to.

Make a page with a redirect <meta> tag and one that refreshes your page.



To Next Advanced HTML Lesson

Back To Advanced HTML Index