in reply to Identifying browsers
A short search with Google brings me to this page, which tells me that most Netscape strings start with something like Mozilla/x.xxx(, and after that first opening parens, there is not the word compatible. This could be checked for with the following crummy code :
sub header_NS { # Assume that nobody uses Netscape anymore my $result = undef; # Get user agent passed as the only parameter my $user_agent = shift; if ($user_agent =~ m#^Mozilla/\d+#i) { # We have a Mozilla/NetScape compatible browser if ($user_agent !~ /compatible/i) { # And it's not even just "compatible", it's the real, # CSS burning, X crashing hellspawn $result = 1; }; }; return $result; };
The above code checks for any browser that claims to beo Mozilla, but also claims to be the real thing and not something compatible. But I think your idea of using User-Agent headers for this is flawed, as there are many instances where proxies change the user agent and there are also other browsers which have real problems with CSS support. I recommend you put a "This site without CSS" link into your script, which calls your script again with the parameter ?nocss=1 appended to the URL. This allows users with broken browsers to easily use your website even if your magic detection does not work because you didn't anticipate their specific browser.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Mozilla vs Netscape IDs
by khopesh (Initiate) on Aug 06, 2002 at 13:51 UTC | |
|
Re: Re: Identifying browsers
by Melly (Chaplain) on Mar 30, 2001 at 18:51 UTC |