This chapter describes how the Trinidad infrastructure determines narrow screen support and how it uses EL (Expression Language) expressions to expose user agent details.
This chapter includes the following sections:
Mobile devices have a wide range of screen widths. As a result, the UI components of a web application may render properly on a device with a screen width measuring 240 pixels, but not align correctly when the application runs on a device that has a screen width of only 100 pixels. In such a situation, Trinidad optimizes application rendering for narrow-screen devices. Trinidad considers any device with a screen width of less than 240 pixels as a narrow screen and optimizes the rendering for the following components accordingly:
tr:breadcrumbs
tr:inputText
tr:navigationPane
tr:panelFormLayout
tr:panelLabelAndMessage
tr:panelRadio
tr:processChoiceBar
tr:selectRangeChoiceBar
Because Trinidad only considers a device with a screen width that measures less than 240 pixels as a narrow screen, it does not consider iPhones (Safari browsers) or BlackBerry smartphones (BlackBerry browsers), which usually have screens that are greater than 240 pixels, as such. For a Windows Mobile browser, Trinidad determines the screen width from the UA-pixels
definition in the request header and only applies narrow screen optimization if the screen width is less than 240 pixels. For all other user agents, however, Trinidad optimizes its rendering for a narrow screen device.
Trinidad exposes a requesting user agent's details using the EL expression, #{requestContext.agent}
, which returns an agent
object that describes the requesting user agent. By adding the detail name or capability name properties to this expression, you enable Trinidad to return details that include the user agent's name, version, platform, the version of the platform, the model (which is applicable only to BlackBerry), and the browser's support for JavaScript and PPR (Partial Page Rendering). For information on exposing user agent details, see Section 7.2.1, "How To Determine User Agent Details." For information on determining browser capabilities, see Section 7.2.2, "How to Determine Browser Capabilities."
When Trinidad receives a request, it parses user agent strings for a variety of user agent details (listed in Table 7-1) that include the type, the name and version of the agent, and the agent's platform name and platform version. Trinidad uses the EL expression #{requestContext.agent.<detail-name>}
to expose these details. For example, to enable you to retrieve the category appropriate to the user agent type (that is, desktop for a desktop browser, or PDA for mobile browsers), Trinidad uses the type
detail in the EL expression as follows:
#{requestContext.agent.type}
Note:
Trinidad may return a null value for such details asPlatformName
and PlatformVersion
if it cannot parse them from the user agent string.Table 7-1 Browser Details Exposed through EL Expressions
Detail Name | Description |
---|---|
|
Identifies a user agent type. For desktop and mobile browsers, the values are desktop and PDA, respectively. Because Safari provides all desktop browser features when it runs in a mobile device, the agent object exposes this detail as a desktop type. |
|
The name of the agent |
|
The version of the agent |
|
The platform on which the agent runs |
|
The version of the platform on which the agent runs |
|
The model of the mobile device |
|
Trinidad categorizes the mobile browsers into different skin types based on their CSS capabilities. For more information, see Section 7.2.1.1, "Determining the Skin Type." |
Trinidad categorizes incoming user agents into different skin family types based on CSS support. It exposes the skin family type using the #{requestContext.agent.skinFamilyType}
EL expression. For example, Trinidad uses this EL expression to derive the value of windowswebkit
for a Safari user agent running in a Windows platform. For Safari browsers running on Symbian devices, this expression returns the Nokia Webkit (nokiawebkit
). Table 7-2 lists the skin family types returned by #{requestContext.agent.skinFamilyType}
according to user agent, platform, and platform version.
Table 7-2 Skin Family Types Returned by the SkinFamilyType Attribute
User Agent | Platform | Skin Family Type |
---|---|---|
Windows mobile |
|
|
Safari |
iPhone/iPod |
|
Safari |
Linux |
|
Safari |
Macintosh |
|
Safari |
Symbian |
|
Safari |
Windows |
|
Safari |
Unknown platforms |
|
Blackberry |
|
|
Blackberry (versions 4.5 and later) |
|
|
All other mobile browsers |
|
Trinidad sends its response to a user agent's request based on the capabilities that it assigns to a user agent. These capabilities include a user agent's support for JavaScript and PPR (partial-page rendering). Some of these capabilities (listed in Table 7-3) are exposed through the EL expression #{requestContext.agent.capabilities}
.
Use the EL expression #{requestContext.agent.capabilities.<capability-name>}
to determine the specific capability assigned to a user agent by Trinidad. For example, to determine whether Trinidad assigns JavaScript capability to a user agent, use the following EL expression:
# {requestContext.agent.capabilities.scriptingSpeed!='none'}
.
Table 7-3 Browser Capabilities Exposed through EL Expressions
Capability Name | Detail |
---|---|
|
Indicates whether Trinidad optimizes its rendering for a narrow-screen device. It returns |
|
Indicates JavaScript support for a user agent. Returns |
|
Indicates PPR support for a user agent. Returns |