Reference / Automatic discovery of User Agent (adua.xrd) |
This topic explains an automatic user agent discovery configuration example.
For new development, use Genero Browser Client, see Genero Web Client for JavaScript (GWC-JS).
Suppose you want to use the DUA_GDC output map for Internet Explorer browsers and DUA_XXX for all other user agents. To achieve this, you have to configure your application to support both Output Maps.
In your GAS configuration file (as.xcf), add an OUTPUT element with a rule identified by UseAllOutputDriver, defining the rendering and theme for two MAP elements identified by the DUA_GDC and DUA_XXX names:
<APPLICATION Id="test" Parent="defaultwa"> <EXECUTION> <PATH>$(res.path.fgldir.demo)</PATH> <MODULE>demo.42r</MODULE> </EXECUTION> <OUTPUT Rule="UseAllOutputDriver"> <MAP Id="DUA_XXX" Allowed="TRUE"> <RENDERING Using="cpn.rendering.wa"/> <THEME Using="cpn.theme.default.xxx"/> </MAP> <MAP Id="DUA_GDC" Allowed="TRUE"> <RENDERING Using="cpn.rendering.wa"/> <THEME Using="cpn.theme.default.gdc"/> </MAP> </OUTPUT> </APPLICATION>
In the adua.xrd file, define the UseAllOutputDriver rule to associate a User-Agent type to a MAP element defined in the as.xcf file:
<RULE Id="UseAllOutputDriver"> <TABLE Id="1" Key="User-Agent"> <ROW> <IN>MSIE</IN> <ACTION Type="RESULT">DUA_GDC</ACTION> </ROW> <ROW> <ACTION Type="RESULT">DUA_XXX</ACTION> </ROW> </TABLE> </RULE>
With this example, if the User-Agent value contains MSIE, GDCAX will be used (identified by DUA_GDC); otherwise the mapping that corresponds to the DUA_XXX will be used.