4. Using UAProf (User
Agent Profile) to Detect User Agent Types and Device Capabilities
4.1. Introduction
UAProf
(User agent profile) is an XML document that contains information
about the user agent type and device capabilities. It is a standard
defined and maintained by the Open Mobile Alliance (formerly the WAP
Forum).
UAProf
was created according to the CC/PP (Composite
Capabilities/Preferences Profiles) framework with RDF (Resource
Description Framework) as the schema. Both CC/PP and RDF were defined
by the W3C (World Wide Web Consortium).
User
agent profiles are stored in a server called the profile repository.
Very often a profile repository is maintained by a mobile device
manufacturer. For example, the user agent profiles describing the
capabilities of Nokia cell phones are stored in a profile repository
maintained by Nokia.
The
URL that points to the user agent profile of a mobile device can be
found in the headers of requests sent by the mobile device. Very
often the URL is located in the x-wap-profile
header or the Profile
header. For example, the value of the x-wap-profile
header generated by a Nokia 6230i cell phone is:
"http://nds1.nds.nokia.com/uaprof/N6230ir200.xml"
A
user agent profile contains a number of components and each
component has a number of attributes. For example, if
you download and open Nokia 6230i's user agent profile, you will find
the ScreenSize attribute
under the HardwarePlatform
component, like this:
... <prf:component> <rdf:Description
rdf:ID="HardwarePlatform"> <rdf:type
rdf:resource= "http://www.openmobilealliance.org/tech/profiles/UAPROF/ccppschema-20021212#HardwarePlatform"/> ... <prf:ScreenSize>208x208</prf:ScreenSize> ... </rdf:Description> </prf:component> ...
From
the above user agent profile, we know that Nokia 6230i cell phones
have a screen size of 208 pixels x 208 pixels.
The
latest approved UAProf specification is WAP-248-UAProf-20011020-a,
which is part of WAP 2.0. The newest version is
OMA-UAProf-V2_0_20030520-C1,
which is still in the candidate phase.
4.2. Where to Find the
URL of the UAProf Document of a Mobile Device
As
mentioned earlier, the URL of the UAProf document of a mobile device
can very often be found in the HTTP headers x-wap-profile
or Profile. For
example, if you look inside the HTTP requests sent by Nokia 6230i,
you will find the following line:
x-wap-profile:
"http://nds1.nds.nokia.com/uaprof/N6230ir200.xml"
If
you cannot find the x-wap-profile
header and the Profile
header in an HTTP request, you may find the URL of the UAProf
document by following the steps below:
1.
Check if there are any Opt
headers in the HTTP request. If yes, read the value of the Opt
header that contains the URL
"http://www.w3.org/1999/06/24-CCPPexchange". The Opt
header should contain something like this:
"http://www.w3.org/1999/06/24-CCPPexchange"
; ns=80
2.
Extract the namespace number in the Opt
header. In the above example, the namespace number is 80.
3.
The URL of the UAProf document should be found in the
NAMESPACE-Profile
header, where NAMESPACE
is the namespace number you found in the Opt
header. For example:
80-Profile:
"http://wap.sonyericsson.com/UAprof/T68R502.xml"
Note
that not all mobile devices support UAProf and so you may not be able
to find the URL of the UAProf document in HTTP headers. If the mobile
device does not support UAProf, you can still find out certain
information about the user agent using traditional HTTP headers such
as Accept, Accept-Charset,
Accept-Language and
User-Agent.
Feedback Form ( ExpandCollapse)
|