[ic] Detect mobile browsers
DB
DB at M-and-D.com
Fri Nov 19 19:51:43 UTC 2010
>> Is there a way to detect mobile browsers from within IC, or is this
>> better done with an Apache redirect or something?
>>
>> DB
>>
>
> Here's a simplistic approach that I use:
> UserTag mobile AddAttr
> UserTag mobile Routine <<EOR
>
> sub {
>
>
> my ($opt) = @_;
>
> if ($opt->{http_user_agent}) {
> return 1 if ($opt->{http_user_agent} =~ /Android/i ||
> $opt->{http_user_agent} =~ /iPhone/ ||
> $opt->{http_user_agent} =~ /BlackBerry/ ||
> $opt->{http_user_agent} =~ /IEMobile/ ||
> $opt->{http_user_agent} =~ /brew/i ||
> $opt->{http_user_agent} =~ /Symbian/i ||
> $opt->{http_user_agent} =~ /mini/i ||
> $opt->{http_user_agent} =~ /mobi/i ||
> $opt->{http_user_agent} =~ /webOs/ ||
> $opt->{http_user_agent} =~ /^XV.*Opera/ ||
> $opt->{http_user_agent} =~ /^htc/i ) ;
> }
> return;
> }
> EOR
>
>
> Called as:
> [if !cgi no_mobile]
> [if type=explicit compare="[mobile http_user_agent=|[env
> HTTP_USER_AGENT]|]"]
> [bounce href="[area mobile]"]
> [/if]
> [/if]
Nice - thanks for sharing!
DB
More information about the interchange-users
mailing list