Latest web development tutorials

propiedad DOM HTML Meta httpEquiv

Referencia Meta Object meta Object

Definición y Uso

httpEquiv conjuntos de propiedades o devuelve el contenido de la propiedad en las cabeceras HTTP.

atributo http-equiv puede utilizar los encabezados de respuesta HTTP camuflaje.

valor del atributo http-equiv depende del valor de la propiedad de contenido.

Nota: Si elatributo de nombre se ha establecido, el atributo http-equiv hay necesidad de configurar.

gramática

Configuración httpEquiv propiedades:

linkObject.httpEquiv="HTTP-header"

Volver propiedades httpEquiv:

linkObject.httpEquiv

Algunos valoresHTTP de cabecera deuso común:

描述
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 指定要载入的框架名


Soporte para el navegador

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Todos los principales navegadores soportan httpEquiv propiedad


Ejemplos

Ejemplos

Muestra la información de la cabecera 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>

Trate »


Referencia Meta Object meta Object