[thelist] Detecting AOL browser (was contract feedback requested?)

deke web at master.gen.in.us
Wed Mar 14 03:24:26 CST 2001


On 13 Mar 2001, at 20:44, Bob Haroche wrote:

> > You *are* aware that some AOL/4 browsers are only Mozilla/2
> > compatible?
> >  Mozilla/2.0 (compatible; MSIE 3.0; AOL 4.0; Windows 3.1)
> >  Mozilla/3.0 (compatible; MSIE 3.01; AOL 4.0; Mac_PPC)

> No, I wasn't aware of that, but that's good to know. Thanks.
 
> I also thought that it was not possible to detect AOL on a PC because, so I
> thought, it identifies itself only as IE.  But I see from your logs it's
> possible to extract the "AOL" from the agent string to detect (redirect) AOL
> users.  Is that right?

Yep. 

If you are doing something inside a CGI, you can access them as
environmental variables.
   if (strstr (getenv("USER_AGENT"), "AOL") != NULL)
		{ do_aol_stuff(); }
or in PERL,
   if ($ENV{'USER_AGENT'} =~ m/AOL/)
		{ &do_aol_stuff; }

If all you want to do is to redirecting users to a different static
page, though, there's no need for all that fuss; you can speed
up your site by eliminating the need to download pages just
for redirection. The Apache documentation suggests using 
something like this in your .htaccess file.

RewriteCond  %{HTTP_USER_AGENT}  ^Mozilla.*
RewriteRule  ^/$                 /homepage.max.html  [L]

RewriteCond  %{HTTP_USER_AGENT}  ^Lynx.*
RewriteRule  ^/$                 /homepage.min.html  [L]
RewriteRule  ^/$                 /homepage.std.html  [L]

This would tend to divide users into three categories -
depending on whether the USER_AGENT string starts
with Mozilla, Lynx, or something else. The only
browser I know of that *doesn't* start with Mozilla is
Lynx. The only spider I know of that *does* start with
Mozilla is AskJeeves.

More details at
http://httpd.apache.org/docs/mod/mod_rewrite.html#RewriteEngine

deke







--------
I got this powdered water. 
Now I don't know what to add. 
            -- Steven Wright




More information about the thelist mailing list