aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/glossary/quality_values
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/glossary/quality_values
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/glossary/quality_values')
-rw-r--r--files/zh-cn/glossary/quality_values/index.html77
1 files changed, 77 insertions, 0 deletions
diff --git a/files/zh-cn/glossary/quality_values/index.html b/files/zh-cn/glossary/quality_values/index.html
new file mode 100644
index 0000000000..326d312ef0
--- /dev/null
+++ b/files/zh-cn/glossary/quality_values/index.html
@@ -0,0 +1,77 @@
+---
+title: Quality values
+slug: Glossary/Quality_values
+translation_of: Glossary/Quality_values
+---
+<p><ruby>质量价值<rt>Quality values</rt></ruby>亦称作q值,其与q因子以逗号分隔的方式来描述值的优先级顺序,是HTTP消息头以及HTML中的特殊语法。值的重要性以一种后缀表示:<code>';q='</code>。该后缀紧接<code>0</code>到<code>1</code>间的值(值可达小数点后三位),最高值表明最高优先级。无此后缀时,默认值为<code>1</code>。</p>
+
+<h2 id="示例">示例</h2>
+
+<p>以下语法</p>
+
+<pre class="notranslate"><code>text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8</code></pre>
+
+<p>表明优先级先后顺序:</p>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Value 值</th>
+ <th scope="col">Priority 优先级</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><code>text/html</code> and <code>application/xhtml+xml</code></td>
+ <td><code>1.0</code></td>
+ </tr>
+ <tr>
+ <td><code>application/xml</code></td>
+ <td><code>0.9</code></td>
+ </tr>
+ <tr>
+ <td><code>*/*</code></td>
+ <td><code>0.8</code></td>
+ </tr>
+ </tbody>
+</table>
+
+<p>如果前面这两个值未定义优先级,值的顺序并不重要。然而,q值相同时,值越具体,其优先级越高。</p>
+
+<pre class="notranslate"><code>text/html;q=0.8,text/*;q=0.8,*/*;q=0.8</code>
+</pre>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Value 值</th>
+ <th scope="col">Priority 优先级</th>
+ </tr>
+ <tr>
+ <td><code>text/html</code></td>
+ <td><code>0.8</code> (but totally specified)</td>
+ </tr>
+ <tr>
+ <td><code>text/*</code></td>
+ <td><code>0.8</code> (partially specified)</td>
+ </tr>
+ <tr>
+ <td><code>*/*</code></td>
+ <td><code>0.8</code> (not specified)</td>
+ </tr>
+ </thead>
+</table>
+
+<p>像Accept消息头的语法可以有额外的标记,比如<code>text/html;level=1</code>。这使值更具体,不过该用法不常见。</p>
+
+<h2 id="浏览器信息">浏览器信息</h2>
+
+<h3 id="火狐">火狐</h3>
+
+<p>从Firefox 18开始,质量因子的值可达小数点后二位(之前的版本只能达小数点后一位)。({{bug(672448)}})</p>
+
+<h2 id="更多">更多</h2>
+
+<ul>
+ <li>使用q值的HTTP消息头:{{HTTPHeader("Accept")}}、{{HTTPHeader("Accept-Charset")}}、{{HTTPHeader("Accept-Language")}}、{{HTTPHeader("Accept-Encoding")}}和{{HTTPHeader("TE")}}。</li>
+</ul>