EN
Ce contenu n’est pas disponible dans votre langue. Voici la version anglaise.

content attribute | content property

Gets or sets meta-information to associate with httpEquiv or name.

HTML 4.01 Specification, Section 7.4.4

 

Syntax

HTML<element content="p" ... >
JScript

p = object.content

 

Property values

Type: String

description

Meta-information.

refresh

Integer consisting of the number of seconds to elapse before the document is refreshed. This value requires the httpEquiv to be set with the refresh value.

url

Location that is loaded when the document is refreshed. This value requires the httpEquiv to be set with the refresh value.

mimetype

MIME type used for the charset value.

charset

Character set of the document. This value requires the mimetype value to be set with a valid MIME type, and the httpEquiv to be set with the refresh value.

noopen

Internet Explorer 6 for Windows XP SP2 and later. Hides the Open or Run button on the File Download dialog box. This value requires the name attribute to be set with the DownloadOptions value.

nosave

Internet Explorer 6 for Windows XP SP2 and later. Hides the Save button on the File Download dialog box. This value requires the name attribute to be set with the DownloadOptions value.

x-ua-compatible

Internet Explorer 8 and later. A comma–delimited list of document compatibility modes supported by the web page. Note that Internet Explorer attempts to display the document in order of the values presented. This value requires the httpEquiv to be set with the x-ua-compatible value. For more info, see Specifying legacy document modes.

Note  As of Windows 8, this is supported only for webpages displayed using Internet Explorer for the desktop.

Standards information

Remarks

Developers using the httpEquiv and content attributes to refresh documents from alternate URLs should treat the value of content as untrusted data. For more information, please see Security Considerations: Dynamic HTML.

As of Internet Explorer 8, the httpEquiv attribute also supports a value of x-ua-compatible, which allows developers to specify the document compatibility mode that Internet Explorer should use to display a webpage. For full details, see Specifying legacy document modes. (As of Windows 8, legacy document modes are supported only for Internet Explorer for the desktop.)

As of Windows 8, you can specify the following values for use with Windows Runtime apps using JavaScript:

Examples

This example causes the browser to reload the document every two seconds.


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

This example causes the browser to refresh the current page using content from a specific URL.


<meta http-equiv="refresh" content="0; url=http://www.contoso.com/registry/fabrikam/specs/latest/1.0/">

Note  According to the underlying specification, the "url=" token is required. Certain browsers, however, treat the token as optional. For interoperability purposes, IE11 on Windows Phone 8.1 Update 1 SDK and Emulators allows "url=" to be optional. For best results, however, you should specify the token.

This example sets the character set for the document.


<meta http-equiv="Content-Type"

      content="text/html; charset=utf-8">

This example disables theme support for the document.


<meta http-equiv="msthemecompatible" content="no">

This example tells Internet Explorer to display a document in IE9 mode, if possible.


<meta http-equiv="X-UA-Compatible" content="IE=9">

See also

Reference
httpEquiv
meta
Conceptual
Defining Document Compatibility

 

 

Afficher:
© 2014 Microsoft