blob: b6fd8208524a061a0269164590e35d07bb2bd7c8 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<title>Apache module mod_browser</title>
</head>
<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
<body bgcolor="#FFFFFF" text="#000000" link="#0000FF"
vlink="#000080" alink="#FF0000">
<!--#include virtual="header.html" -->
<h1 align="CENTER">Module mod_browser</h1>
This module is contained in the <code>mod_browser.c</code>
file, and is compiled in by default. It provides for setting
environment variables based on the browser. This module is part
of Apache 1.2.* only. From Apache 1.3 onwards <code><a
href="mod_setenvif.html">mod_setenvif</a></code> provides the
functionality of this module.
<h2>Summary</h2>
<p>This module allows you to set environment variables based on
the name of the browser accessing your document, based on the
<code>User-Agent</code> header field. This is especially useful
when combined with a conditional HTML language such as <a
href="mod_include.html">XSSI</a> or PHP, and can provide for
simple browser-based negotiation of HTML features.</p>
<h2>Directives</h2>
<ul>
<li><a href="#browsermatch">BrowserMatch</a></li>
<li><a href="#browsermatchnocase">BrowserMatchNoCase</a></li>
</ul>
<hr />
<h2><a id="browsermatch"
name="browsermatch">BrowserMatch</a></h2>
<a href="directive-dict.html#Syntax"
rel="Help"><strong>Syntax:</strong></a> BrowserMatch <em>regex
attr1 attr2...</em><br />
<a href="directive-dict.html#Context"
rel="Help"><strong>Context:</strong></a> server config<br />
<a href="directive-dict.html#Status"
rel="Help"><strong>Status:</strong></a> base<br />
<a href="directive-dict.html#Module"
rel="Help"><strong>Module:</strong></a> mod_browser<br />
<a href="directive-dict.html#Compatibility"
rel="Help"><strong>Compatibility:</strong></a> Apache 1.2 and
above
<p>The BrowserMatch directive defines environment variables
based on the User-Agent header. The first argument should be a
POSIX.2 extended regular expression (similar to an egrep-style
regex). The rest of the arguments give names of variables to
set. These take the form of either "<code>varname</code>",
"<code>!varname</code>" or "<code>varname=value</code>". In the
first form, the value will be set to "1". The second will
remove the given variable if already defined, and the third
will set the variable to the value given by <code>value</code>.
If a User-Agent string matches more than one entry, they will
be merged. Entries are processed in the order they appear, and
later entries can override earlier ones.</p>
<p>For example:</p>
<pre>
BrowserMatch ^Mozilla forms jpeg=yes browser=netscape
BrowserMatch "^Mozilla/[2-3]" tables agif frames javascript
BrowserMatch MSIE !javascript
</pre>
<h2><a id="browsermatchnocase"
name="browsermatchnocase">BrowserMatchNoCase</a></h2>
<a href="directive-dict.html#Syntax"
rel="Help"><strong>Syntax:</strong></a> BrowserMatchNoCase
<em>regex attr1 attr2...</em><br />
<a href="directive-dict.html#Context"
rel="Help"><strong>Context:</strong></a> server config<br />
<a href="directive-dict.html#Status"
rel="Help"><strong>Status:</strong></a> base<br />
<a href="directive-dict.html#Module"
rel="Help"><strong>Module:</strong></a> mod_browser<br />
<a href="directive-dict.html#Compatibility"
rel="Help"><strong>Compatibility:</strong></a> Apache 1.2 and
above
<p>The <code>BrowserMatchNoCase</code> directive is
semantically identical to the <a
href="#browsermatch"><code>BrowserMatch</code></a> directive.
However, it provides for case-insensitive matching. For
example:</p>
<pre>
BrowserMatchNoCase mac platform=macintosh
BrowserMatchNoCase win platform=windows
</pre>
<p><!--#include virtual="footer.html" -->
</p>
</body>
</html>