HTML and CSS Reference
In-Depth Information
// or on an iPad
platform.name; // '
Safari
'
platform.version; // '
5.1
'
platform.product; // '
iPad
'
platform.manufacturer; // '
Apple
'
platform.layout; // '
WebKit
'
platform.os; // '
iOS
5.0
'
platform.description; // '
Safari
5.1
on
Apple
iPad
(
iOS
5.0
)
'
// or parsing a given UA string
var info = platform.parse('
Mozilla
/
5.0
(
Macintosh
;
Intel
Mac
OS
X
10.7
.
2
;
en
;
rv
:
2.0
)
Gecko
/
20100101
Firefox
/
4.0
Opera
11.52
');
info.name; // '
Opera
'
info.version; // '
11.52
'
info.layout; // '
Presto
'
info.os; // '
Mac
OS
X
10.7
.
2
'
info.description; // '
Opera
11.52
(
identifying
as
Firefox
4.0
)
on
Mac
OS
X
10.7
.
2
'
Server-Side userAgent Detection
On the server side,
MobileESP
is an open source framework, which detects the
user
Agent
header. This gives you the ability to direct the user to the appropriate page and
allows other developers to code to supported device features.
MobileESP is available in six languages:
• PHP
• Java (server side)
• ASP.NET (C#)
• JavaScript
• Ruby
• Classic ASP (VBscript)
In Java, you would use:
userAgentStr
=
request
.
getHeader
(
"user-agent"
);
httpAccept
=
request
.
getHeader
(
"Accept"
);
uAgentTest
=
new
UAgentInfo
(
userAgentStr
,
httpAccept
);
If
(
uAgentTest
.
detectTierIphone
()){
...
//Perform redirect
}