**Allowed values:**
β’ `public` - Anyone can cache the content (client and proxy servers).
β’ `private` - Only the client browser can cache the content.
β’ `no-cache` - The browser must revalidate with the server before using a cached copy.
β’ `no-store` - The browser and proxies must not cache or store any part of the page. | `` | | **content-language** | Specifies the primary language of the document. | `` | | **content-type** | Declares the MIME type and character encoding of the document. | `` | | **date** | Specifies the date and time the document was generated. | `` | | **expires** | Specifies the date and time after which the document is considered expired. | `` | | **last-modified** | Specifies the date and time the document was last modified. | `` | | **location** | Used to redirect the client to another URL. | `` | | **refresh** | Defines a time interval (in seconds) after which the page should automatically reload or redirect to another URL. | `` *(Refreshes every 5 minutes)* | | **set-cookie** | Sets a cookie on the client side. Defines cookie name, value, expiration, and path. | `` | | **window-target** | Specifies the target window or frame in which the page should be loaded. | `` | --- ## Browser Support The `httpEquiv` property is fully supported by all major modern web browsers: * Google Chrome * Mozilla Firefox * Microsoft Edge / Internet Explorer * Safari * Opera --- ## Code Examples ### Example 1: Get the http-equiv Attribute Value The following example demonstrates how to retrieve the value of the `http-equiv` attribute from the first `` tag in the document. ```html
Click the button below to display the value of the meta tag's http-equiv attribute.
``` ### Example 2: Dynamically Setting http-equiv You can also dynamically change or set the `httpEquiv` property using JavaScript: ```javascript // Select the meta element var metaTag = document.getElementsByTagName("meta"); // Set the http-equiv to refresh the page metaTag.httpEquiv = "refresh"; metaTag.content = "10"; // Refreshes the page every 10 seconds ``` --- ## Considerations and Best Practices 1. **HTML5 Standard:** In HTML5, setting the character encoding using `` is still supported, but the shorter syntax `` is highly recommended for simplicity and performance. 2. **Security Restrictions:** Modern browsers may ignore certain `http-equiv` directives (like `set-cookie`) when set via `` tags due to security policies (such as HTTPOnly cookies). It is always safer to set cookies and security policies (like CSP) via actual server-side HTTP headers. 3. **Performance:** Using `` for redirection is generally discouraged for SEO and accessibility reasons. A server-side 301 or 302 redirect is preferred.
YouTip