Agent Plugin
This plugin allows to identify a browser according to it's the user_agent string it supplies in the query.
- Use
%AGENT% to print out the whole user_agent information.
- Your Browser identifies as: %AGENT%
- Use
%AGENT{check="TYPE}% to choose predefined version independent identification.
- Your Browser identifies as: %AGENT{check="TYPE"}%
- Use
%AGENT{check="VERSION"}% to choose predefined version dependent identification.
- Your Browser identifies as: %AGENT{check="VERSION"}%
- Use
%AGENT{check="msie netscape4 netscape7"}% to select your own ID set - note that most specific rule names must be listed first
- Your Browser yields: %AGENT{check="msie netscape4 netscape7"}%
- Add
none="idontknow" to choose a different fallback id from "%AGENTPLUGIN_NONE%"
- Use
%AGENT{check="gecko6 gecko7" none="nogecko" expgecko6="Gecko.*6" expgecko7="Gecko.*7"}% to specify seldomly needed checks
- Your Browser yields: %AGENT{check="gecko6 gecko7" none="nogecko" expgecko6="Gecko.*6" expgecko7="Gecko.*7"}%
- Any non-alphanumeric character will be removed from the listes IDs for the check whilst the original ID will be returned:
%AGENT{check=".msie .netscape" none=""}%
- Your Browser yields "%AGENT{check=".msie .netscape"}%"
Plugin settings are stored as preferences variables. To reference
a plugin setting write
%_%, i.e.
%AGENTPLUGIN_SHORTDESCRIPTION%
- One line description, is shown in the TextFormattingRules topic:
- Set SHORTDESCRIPTION = This plugin identifies a browser using configurable rules.
- Fallback value for nonmatching user agents:
- Predefined ID sets - note that most specific rule names must be listed first:
- Set CHECKTYPE = msie netscape
- Set CHECKVERSION = msie50 msie52 msie5 msie netscape4 netscape6 netscape7 netscape
- Then, define expressions the user_agent information should be checked against to return the above identifiers:
- Set EXPMSIE = MSIE
- Set EXPMSIE5 = MSIE 5
- Set EXPMSIE50 = MSIE 5.0
- Set EXPMSIE52 = MSIE 5.2
- Set EXPNETSCAPE = Netscape
- Set EXPNETSCAPE4 = Netscape/4
- Set EXPNETSCAPE6 = Netscape/6
- Set EXPNETSCAPE7 = Netscape/7
- Debug plugin: (See output in
data/debug.txt)
Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running.
- Download the ZIP file from the Plugin web (see below)
- Unzip
AgentPlugin.zip in your twiki installation directory. Content:
|
|
| File: |
Description: |
data/TWiki/AgentPlugin.txt |
Plugin topic |
data/TWiki/AgentPlugin.txt,v |
Plugin topic repository |
lib/TWiki/Plugins/AgentPlugin.pm |
Plugin Perl module |
|
|
|
- Test if the plugin is correctly installed:
- Your Browser identifies as "%AGENT%"
Related Topics: TWikiPreferences,
TWikiPlugins
--
AndyThaller - 31 Oct 2002