Mercurial > hg > nginx-site
view xml/cn/docs/http/ngx_http_browser_module.xml @ 980:532c10d1cb9f
Donors added.
author | Maxim Konovalov <maxim@nginx.com> |
---|---|
date | Mon, 09 Sep 2013 09:18:13 +0000 |
parents | 9934338f83af |
children |
line wrap: on
line source
<?xml version="1.0"?> <!-- Copyright (C) Igor Sysoev Copyright (C) Nginx, Inc. --> <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> <module name="ngx_http_browser_module模块" link="/cn/docs/http/ngx_http_browser_module.html" lang="cn" translator="litianqing" rev="1"> <section id="summary"> <para> 模块<literal>ngx_http_browser_module</literal>创建变量,它们的值取决于 请求头中<header>User-Agent</header>的值: <list type="tag"> <tag-name><var>$modern_browser</var></tag-name> <tag-desc> 如果浏览器被为识别为新式浏览器,该值等于<link id="modern_browser_value"/>指令设置的值; </tag-desc> <tag-name><var>$ancient_browser</var></tag-name> <tag-desc> 如果浏览器被识别为旧式浏览器,该值等于<link id="ancient_browser_value"/>指令设置的值; </tag-desc> <tag-name><var>$msie</var></tag-name> <tag-desc> 如果浏览器被识别为任何版本的MSIE,该值等于“1”。 </tag-desc> </list> </para> </section> <section id="example" name="配置示例"> <para> 选择一个默认页: <example> modern_browser_value "modern."; modern_browser msie 5.5; modern_browser gecko 1.0.0; modern_browser opera 9.0; modern_browser safari 413; modern_browser konqueror 3.0; index index.${modern_browser}html index.html; </example> </para> <para> 旧式浏览器的重定向: <example> modern_browser msie 5.0; modern_browser gecko 0.9.1; modern_browser opera 8.0; modern_browser safari 413; modern_browser konqueror 3.0; modern_browser unlisted; ancient_browser Links Lynx netscape4; if ($ancient_browser) { rewrite ^ /ancient.html; } </example> </para> </section> <section id="directives" name="指令"> <directive name="ancient_browser"> <syntax><value>string</value> ...</syntax> <default/> <context>http</context> <context>server</context> <context>location</context> <para> 如果任一指定的子串在请求头的<header>User-Agent</header>域中被发现,浏览器将被认定为旧式浏览器。 特殊字符串“<literal>netscape4</literal>” 相当于正则表达式“<literal>^Mozilla/[1-4]</literal>”。 </para> </directive> <directive name="ancient_browser_value"> <syntax><value>string</value></syntax> <default>1</default> <context>http</context> <context>server</context> <context>location</context> <para> 设定变量<var>$ancient_browser</var>的值。 </para> </directive> <directive name="modern_browser"> <syntax><value>browser</value> <value>version</value></syntax> <syntax><literal>unlisted</literal></syntax> <default/> <context>http</context> <context>server</context> <context>location</context> <para> 指定一个版本,此版本及后续版本的浏览器都被认定为新式浏览器。 浏览器可以是下列之一: <literal>msie</literal>, <literal>gecko</literal> (基于Mozilla), <literal>opera</literal>,<literal>safari</literal>, 或者 <literal>konqueror</literal>。 </para> <para> 版本可被指定为以下形式:X, X.X, X.X.X, 或 X.X.X.X。 每一形式的最大值分别是4000, 4000.99, 4000.99.99, 和 4000.99.99.99。 </para> <para> 浏览器既没有在<literal>modern_browser</literal>中列出,又没有在<link id="ancient_browser"/>中 列出时,如果配置了特殊值<literal>unlisted</literal>,那么浏览器将被认定为新式浏览器,否则 认定为旧式浏览器。 如果请求头中没有<header>User-Agent</header>域,浏览器以没有列出对待。 </para> </directive> <directive name="modern_browser_value"> <syntax><value>string</value></syntax> <default>1</default> <context>http</context> <context>server</context> <context>location</context> <para> 设定变量<var>$modern_browser</var>的值。 </para> </directive> </section> </module>