Latest web development tutorials

propriété DOM HTML Meta httpEquiv

Meta Object Reference Meta Object

Définition et utilisation

httpEquiv ensembles de propriétés ou renvoie le contenu de la propriété dans les en-têtes HTTP.

attribut http-equiv peut être utilisé en-têtes de réponse HTTP de camouflage.

valeur d'attribut http-equiv dépend de la valeur de la propriété contenu.

Remarque: Si l'attributname a été défini, l' attribut http-equiv est pas nécessaire de régler.

grammaire

Réglage httpEquiv propriétés:

linkObject.httpEquiv="HTTP-header"

Retour httpEquiv propriétés:

linkObject.httpEquiv

Certaines valeursHTTP d'en-têtecouramment utilisés:

描述
cache-control 控制文档的缓存机制。

允许的值:

  • public - 所有内容都将被缓存(客户端和代理服务器都可缓存)
  • private - 内容只缓存到私有缓存中(仅客户端可以缓存,代理服务器不可缓存)
  • no-cache - 不缓存
  • no-store - 缓存当不归档 but not archived

实例:

<meta http-equiv="cache-control" content="no-cache">

content-language 响应体的语言

实例:

<meta http-equiv="content-language" content="en-US">

content-type 返回内容的MIME类型

提示:通常用于字符集的设置。

实例:

<meta http-equiv="content-type" content="text/html; charset=UTF-8">

date 原始服务器消息发出的时间

实例:

<meta http-equiv="date" content="Wed, 16 Feb 2011 22:34:13 GMT">

expires 响应过期的日期和时间

实例:

<meta http-equiv="expires" content="Fri, 30 Dec 2011 12:00:00 GMT">

last-modified 请求资源的最后修改时间

实例:

<meta http-equiv="last-modified" content="Mon, 03 Jan 2011 17:45:57 GMT">

location 用来重定向接收方到非请求URL的位置来完成请求或标识新的资源

实例:

<meta http-equiv="location" content="URL=http://www.w3big.com">

refresh 定义间隔多久后刷新页面。

实例:

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

set-cookie 创建一个 cookie ,包含了 cookie 名,cookie 值,过期时间。

实例:

<meta http-equiv="set-cookie" content="w3bigcookie=myContent;expires=Fri, 30 Dec 2015 12:00:00 GMT; path=http://www.w3big.com">

window-target 指定要载入的框架名


support du navigateur

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Tous les principaux navigateurs supportent httpEquiv propriété


Exemples

Exemples

Affiche les informations d'en-tête HTTP:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script>
function displayResult(){
    var x=document.getElementsByTagName("meta")[0].httpEquiv;
    alert(x);
}
</script>
</head>
<body>

<button type="button" onclick="displayResult()">显示 HTTP-Equiv</button>

</body>
</html>

Essayez »


Meta Object Reference Meta Object