Before we go anywhere, we need to know how to detect a browser.
Every time a browser makes a request to the webserver, it sends certain information. One of these bits of information is a browser identification string. This is then made available by the webserver for use on the web page, in the form of an Apache enviroment variable.
Hitoplive allows access to Apache's enviroment variables, which can be accessed by a simple
<@GET NAME="ENV_[variablename]">
where [variablename] is the name of the Apache enviroment
variable. To get the browser identification, we need to use the variable
ENV_HTTP_USER_AGENT, the user agent string.
For various reasons, this variable might not exist (in Konqueror for
example you can turn it off), so when using it, it's best to detect to see if
it does exist before using it. This is done with a simple @IF
statement, without a VALUE attribute, eg:
<@IF NAME="ENV_HTTP_USER_AGENT">
<@GET NAME="ENV_HTTP_USER_AGENT">
</@IF>
So for a real live example, lets look at your browser right now. For your browser, the information we get is:
Wget/1.11.4
The actual user agent information given will vary on a variety of factors, but will always contain certain elements, depending on the browser. The following browsers will normally contain the following strings:
MSIE.Mozilla.Opera.Konqueror.Links.Lynx.A version number should also be included, although just to confuse you, some browsers, including Internet Explorer 5, will first proclaim to be Mozilla/4.0!
Where this information appears in the browser ID tag depends on many factors, and its not in our remit to cover them here! But it should appear somewhere. Even browsers like Opera which can pretend to be other browsers, will always contain its true identity somewhere.