- HTML Tutorial
- HTML - Home
- HTML - History and Evolution
- HTML - Overview
- HTML - Editors
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Headings
- HTML - Paragraphs
- HTML - Quotations
- HTML - Comments
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Style Sheet
- HTML - CSS Classes
- HTML - CSS IDs
- HTML - Images
- HTML - Image Map
- HTML Tables
- HTML - Tables
- HTML - Headers & Caption
- HTML - Table Styling
- HTML - Table Colgroup
- HTML - Nested Tables
- HTML Lists
- HTML - Lists
- HTML - Unordered Lists
- HTML - Ordered Lists
- HTML - Definition Lists
- HTML Links
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Iframes
- HTML - Blocks
- HTML Backgrounds
- HTML - Backgrounds
- HTML Colors
- HTML - Colors
- HTML - RGB
- HTML - HEX
- HTML - HSL
- HTML Forms
- HTML - Forms
- HTML - Form Attributes
- HTML - Form Control
- HTML - Input Attributes
- HTML Media
- HTML - Video Element
- HTML - Audio Element
- HTML - Embed Multimedia
- HTML Header
- HTML - Head Element
- HTML - Adding Favicon
- HTML - Javascript
- HTML Layouts
- HTML - Layouts
- HTML - Layout Elements
- HTML - Layout using CSS
- HTML - Responsiveness
- HTML - Symbols
- HTML - Emojis
- HTML - Style Guide
- HTML Graphics
- HTML - SVG
- HTML - Canvas
- HTML APIs
- HTML - Geolocation API
- HTML - Drag & Drop API
- HTML - Web Workers API
- HTML - WebSocket
- HTML - Web Storage
- HTML - Server Sent Events
- HTML Miscellaneous
- HTML - MathML
- HTML - Microdata
- HTML - IndexedDB
- HTML - Web Messaging
- HTML - Web CORS
- HTML - Web RTC
- HTML Demo
- HTML - Audio Player
- HTML - Video Player
- HTML - Web slide Desk
- HTML Tools
- HTML - Velocity Draw
- HTML - QR Code
- HTML - Modernizer
- HTML - Validation
- HTML - Color Code Builder
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
- HTML Resources
- HTML - Quick Guide
- HTML - Useful Resources
- HTML - Color Code Builder
- HTML - Online Editor
HTML - http-equiv Attribute
The HTML http-equiv attribute is used to define the pragma directive. Pragma directives correspond to headers for describing metadata.
This attribute is named http-equiv, because all the allowed values are names of particular HTTP headers.
If the value of the http-equiv attribute is set to refresh and the content attribute accepts the time interval and URL of any website or page, it will refresh the page and redirect it to the given URL after the time interval.
The refresh instruction specifies the number of seconds until the page should be reloaded, only if the content attribute contains a non-negative value.
Following are the list of values supported by the http-equiv –
- content-security-policy
- content-type
- default-style
- x-ua-compatible
- refresh
Syntax
Following is the syntax for HTML http-equiv attribute −
<meta http-equiv = "value"></meta>
Example
In the following example, the HTML 'http-equiv' attribute is used within an <meta> element to define a pragma directive. We specify the string "refresh" as the value of this attribute which defines that the page should refresh with respect to the time interval.
<!DOCTYPE html> <html lang="en"> <head> <!--http-equiv attribute--> <meta http-equiv="refresh" content="10"> <title>HTML 'http-equiv' attribute</title> </head> <body> <!--HTML 'content' attribute--> <p>Example of the HTML 'http-equiv' attribute</p> <h3>The page should be refreshed automatically with respect to the time interval.</h3> </body> </html>
When we run the above code, it will generate an output consisting of the text on the webpage. after certain time interval the webpage gets refreshed on its own.
Example
Cponsider the another scenario, where we are going to use the ‘http-equiv’ attribute within the <meta> tag to define the pragma directive.
<!DOCTYPE html> <html lang="en"> <head> <!--http-equiv attribute--> <meta http-equiv="refresh" content="10; url = https://www.tutorialspoint.com/index.htm"> <title>HTML 'http-equiv' attribute</title> </head> <body> <!--HTML 'http-equiv' attribute--> <p>Example of the HTML 'http-equiv' attribute</p> <p>The page will redirect to the Tutorialspoint website after the given time interval.</p> </body> </html>
On running the above code, the output window will pop up displaying the text on the webpage it will gets refreshed for evry 10seconds on its own and redirects.
To Continue Learning Please Login
Login with Google