aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/http/headers/pragma/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/http/headers/pragma/index.html')
-rw-r--r--files/zh-cn/web/http/headers/pragma/index.html79
1 files changed, 79 insertions, 0 deletions
diff --git a/files/zh-cn/web/http/headers/pragma/index.html b/files/zh-cn/web/http/headers/pragma/index.html
new file mode 100644
index 0000000000..1aa4fe2f09
--- /dev/null
+++ b/files/zh-cn/web/http/headers/pragma/index.html
@@ -0,0 +1,79 @@
+---
+title: Pragma
+slug: Web/HTTP/Headers/Pragma
+tags:
+ - 缓存
+ - 通用首部
+ - 首部
+translation_of: Web/HTTP/Headers/Pragma
+---
+<div>{{HTTPSidebar}}</div>
+
+<p><code><strong>Pragma</strong></code> 是一个在 HTTP/1.0 中规定的通用首部,这个首部的效果依赖于不同的实现,所以在“请求-响应”链中可能会有不同的效果。它用来向后兼容只支持 HTTP/1.0 协议的缓存服务器,那时候 HTTP/1.1 协议中的 Cache-Control 还没有出来。</p>
+
+<div class="note">
+<p><strong>注意:</strong>由于 Pragma 在 HTTP 响应中的行为没有确切规范,所以不能可靠替代 HTTP/1.1 中通用首部 Cache-Control,尽管在请求中,假如 Cache-Control 不存在的话,它的行为与 Cache-Control: no-cache 一致。建议只在需要兼容 HTTP/1.0 客户端的场合下应用 Pragma 首部。</p>
+</div>
+
+<table class="properties">
+ <tbody>
+ <tr>
+ <th scope="row">Header type</th>
+ <td>{{Glossary("General header")}}, but response behavior is not specified and thus implementation-specific.</td>
+ </tr>
+ <tr>
+ <th scope="row">{{Glossary("Forbidden header name")}}</th>
+ <td>no</td>
+ </tr>
+ <tr>
+ <th scope="row">{{Glossary("Simple response header", "CORS-safelisted response-header")}}</th>
+ <td>yes</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox">Pragma: no-cache
+</pre>
+
+<h2 id="指令">指令</h2>
+
+<dl>
+ <dt>no-cache</dt>
+ <dd>
+ <p>与 Cache-Control: no-cache 效果一致。强制要求缓存服务器在返回缓存的版本之前将请求提交到源头服务器进行验证。</p>
+ </dd>
+</dl>
+
+<h2 id="示例">示例</h2>
+
+<pre>Pragma: no-cache</pre>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Title</th>
+ </tr>
+ <tr>
+ <td>{{RFC("7234", "Pragma", "5.4")}}</td>
+ <td>Hypertext Transfer Protocol (HTTP/1.1): Caching</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("http.headers.Pragma")}}</p>
+
+<h2 id="相关内容">相关内容</h2>
+
+<ul>
+ <li>{{HTTPHeader("Cache-Control")}}</li>
+ <li>{{HTTPHeader("Expires")}}</li>
+</ul>