TJ_Vreugdenhil
Mar 04, 2012Cirrus
Android tablet useragent vs. Android mobile useragent
Only mobile devices are supposed to redirect in this scenario, but android tablets are recognized as mobile devices because their useragent is not very unique. Please see below:
when HTTP_REQUEST {
set httpuri [string tolower [HTTP::uri]]
set useragent [string map {" " "_"} [string tolower [HTTP::header user-agent]]]
if {
((!($useragent contains "firefox"))) && (([class match $useragent contains MOBILE_DEVICE_LIST]))
|| ([HTTP::header x-wap-profile] ne "")
}{
HTTP::redirect http://redirectpage
} }
class MOBILE_DEVICE_LIST {
{
"android"
...
...
...
}
}
Example Useragent for android mobile
mozilla/5.0_(linux;_u;_android_2.3.5;_en-us;_n860_build/gingerbread)_applewebkit/533.1_(khtml,_like_gecko)_version/4.0_mobile_safari/533.1
Example Useragent for android tablet
mozilla/5.0_(linux;_u;_android_3.1;_en-us;_gt-p7510_build/hmj37)_applewebkit/534.13_(khtml,_like_gecko)_version/4.0_safari/534.13
What is the best way to not inclue the andriod tablet in the redirect? Take out 'andriod' and put in '4.0_mobile_safari'?