Working on a form for a per-page survey (was this easy to find, yadda yadda) to compliment a general site survey. One of the (many) problems with the current AAAS site template is that it caters to older browsers such as Navigator 4.x. A truly outdated browser and difficult to develop for on the best of days (especially when compared to the beauty of CSS, JS, and DOM development on Mozilla). So the site uses tables nested in tables something like six layers deep for the main content and navigation. Then the secondary navigation is repositioned using JS. What fun!
So I felt it would be nice to have the survey show up in the left-hand column under the navigation. A fairly obvious location. The problem is that Nav4 doesn't like forms in positioned DIVs. Putting a form inside a positioned DIV pretty much breaks the Nav4 DOM. Not a pretty sight.
Anyway, to get around it I just decided to use a little bit of hackery known as the browser check. I hate to do it because it's a crutch for bad coding, but I was really left with no other choice. Honest! Anyway, I whipped up a quick regular expression to test the browser string against. It's not pretty, but it gets the job done:
Mozilla/4.\d\d? \[..\]
This one required a little more fudging since IE uses the old mozilla compatibility string (thank you Microsoft). Spent about a day trying to figure out a way to get things working for Nav4, but in the end there's not much you can do. If there's a match the form won't be shown, but I don't feel too bad because our Nav4 userbase is miniscule.