Simulate an HTTP Header
The meta element can override the value of one of the HTTP (Hypertext Transfer Protocol) headers. The http-equiv attribute specifies which header you want to simulate. The content attribute provides the value.
The following code specifies to the refresh(reload) the page every five seconds.
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
<meta charset="utf-8" />
<meta http-equiv="refresh" content="5" />
</head>
<body>
<a href="http://java2s.com">Visit java2s.com</a>
</body>
</html>
There are three permitted values for the http-equiv attribute:
Attribute Value | Description |
---|---|
refresh | specifies a period in seconds, after which the current page should reload. You can specify a different URL to be loaded. For example: <meta http-equiv="refresh" content="5; http://www.java2s.com"/> |
default-style | specifies the preferred stylesheet. The value of the content attribute must match the title attribute on a script or link element in the same page. |
content-type | This is an alternative way of specifying the character encoding of the HTML page. For example: <meta http-equiv="content-type" content="text/html charset=UTF-8"/> |
Home
HTML CSS Book
HTML
HTML CSS Book
HTML
Document Structure:
- The doctype Element
- The html Element
- The head Element
- The body Element
- Setting the Document Title
- Setting the Base for Relative URLs
- Specifying Name/Value Metadata Pairs
- Declaring a Character Encoding
- Simulate an HTTP Header
- Defining CSS Styles
- Specifying the Media for a Style
- Denoting External Resources
- Defining a Favicon for Your Page
- Using the Scripting Elements
- Loading an External Scripting Library
- Deferring Execution of a Script
- Executing a Script Asynchronously
- The noscript Element
- Redirect the user to a different URL if it doesn't support JavaScript.
Related: