Should we check the browser?
A while back I talked about how to check which browser was in use by a site’s visitors, and gave an example of a redirection script. The principal point I wanted to make was that the way to check which browser was being used was to check the browser, not features such as document.all. It is worth repeating that just because a browser reports that it recognises document.all does not mean that it is MSIE. If you assume that it is, the results may be unexpected and undesirable. If you need to — no, if you want to — check the browser, do so using the information it provides about its identity.
However, one thing I did not raise was the question of whether we should be checking the browser in use. That’s what this article is about.
The first thing to say is that checking the identity of the browser is not such a simple matter as you might think. One of the reasons for that is crap web authoring which always assumes that netsurfers will be using either MSIE or Netscape, nothing else. Hence you go along using a third party browser only to find you are staring at a blank screen.
Well, just as in an arms race the development of a new weapon provokes the development of new defences on the other side, third party browser vendors and users have responded to this. The simple fact is a browser which shows up in your stats as “Internet Explorer” or “Netscape” may be nothing of the kind: some third party browsers allow the user to decide how it identifies itself, right down to the version number returned, so that they can get into thoughtlessly designed sites.
“How do I get around that?” you ask.
You don’t. There’s no comeback against this one.
Maybe you are thinking that if users choose to have their browser masquerade as something it isn’t, then it’s their problem if a site fails as a result. Well, that’s not wholly unjust, I suppose — but they won’t see it like that. If your site falls apart, they’ll assume you suck — and they may well tell their friends. This is not a good outcome.
The other point it’s time to consider is that the necessity for using browser detection scripts is beginning to diminish. A couple of years ago it was understandable that a lot of people wanted to use them. Visitors to your site could be using MSIE 4+ in which case there was reasonable CSS support (including absolute positioning) or NS 4+ in which case there was so-so CSS support, or they could be using an older or a different browser, in which case the chances were that CSS was not (or badly) supported. Similarly, the older/different browsers would be likely to hit problems if there was a lot of scripting used. There was some sense in using a browser detection script to redirect the user to an appropriate page or section of the site. Sometimes, the Netscape 4 users would need different pages from the MSIE 4 users.
Things are changing. Netscape ‘6’ has finally arrived and, although the initial release of the browser had its problems, reports of the 6.1 preview suggest they are being ironed out (although I think I might stick with Mozilla). MSIE 6 is also on the way. MSIE 5 for the Mac is pretty compliant with standards, and the word on the betas is that MSIE 6 for Windows will be at least as good in that respect. Netscape 6 is the most standards-compliant browser the major vendors have ever produced. Additionally, Opera (again, very standards-compliant) is winning new friends now that it is free. On the Mac platform, iCab is heading towards a final version, when it will be standards compliant.
Netscape 4 is now widely recognised for the shambling, obsolete monstrosity it is. Its usage is declining, possibly not quite as much as Netscape 6’s is rising. Assuming that Netscape 6 does manage to claim a chunk of the market — never underestimate the antipathy of the intelligent towards the dark works of Microsoft — and that MSIE 6 appears soon and users migrate from MSIE 4/5 to it fairly smoothly, in 18 months to two years about 95% of the browsers in use should be pretty compliant with the standards for CSS and (X)HTML — the DOM might be a different matter, though.
What that means is that one page can be designed which will work in MSIE and Netscape (and Opera and iCab and maybe others), and work well. There will still be people using older browsers — at the moment I still occasionally see hits from Netscape 2 — but while the sites won’t be so aesthetically satisfying, a well-designed site will still be usable in older browsers. Worries about CSS-heavy sites causing major problems for residual Netscape 4 users can be put aside: the standards-compliant browsers can import stylesheets (using the @import syntax) which NN4 does not understand, so these stylesheets are hidden from it.
OK, that’s a while off. But the time to start preparing is now. The way to start preparing is to get to grips with writing standards-compliant, nonproprietary HTML or XHTML; start using CSS instead of tags like <font>, <s>, and so on; and look for alternatives to the script-heavy, frame-based sites so many of us are producing at the moment.
© DC 2001. All rights reserved.


