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.


In reply to Re: Identifying browsers by Corion
in thread Identifying browsers by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.