— left handed typing since 2001

Magnifying glass for search box

Snif my browser 27.11.2002

In order to make the current design, I rely heavily on CSS2 for positioning. A lot of browsers are not confident adhering to those standards, and I don't feel like denying entrance to these pages based on peoples choice of browsers [yeah, I am all for freedom of choice and shit (: ]. Instead, I decided to serve a dumbed down CSS-sheet for the challenged browsers. For that purpose I whipped up an ugly, miserable, and faulty browser-sniffer in PHP, and I already hear the cries of woe from all around the interweb: "Why did you make a browser sniffer? The web is crawling with them already, you freak!".

Allow me to retort.

PHP is still new to me, and I want to learn more of it. I had a sniffer before, homemade as well, but it didn't quite fit the bill, so I wanted to make a new one, which probably turns out to be even more ugly, miserable, and faulty than the old one I had. Sue me.

Still being a newbie at PHP, looking at the source code will probably make you laugh hysterically. When you are done laughing, please drop me a note telling me what I can do better. It's the only way I can learn this skanking language.

If you like it, and you can make good use of it, grab it all and head for the hills. Don't forget to tell me though, I'd love to be able to tell my children I actually made something that people could use.

Obviously, I'm not trying to make an exhaustible check for all known browsers, I merely divide them into the following two groups, based on their ability to cope with CSS2:

  • "Yes, I can understand your CSS2 perfectly well thank you, and I'll have mine black."

    These are typically browsers that are based on the gecko engine such as Netscape 6+, Mozilla, Chimera, Phoenix, Galeon, Konqueror and as a curious fact, IE5.x for mac.

  • "Oh no, position: fixed! Are you trying to kill me?! I'll have a decaf."

    Browsers in this category include: IE for PC (all versions), OmniWeb, iCab, Opera [not too sure about the new beta], and of course Netscape pre 6.

As a special service to people who travels with Netscape in its pre-gecko incarnations, and text-based browsers, they get a plain HTML version, no CSS. It seems to be the best way.

Thanks to Andreas and Thomas for helping me testing it on browsers for that other platform. Andreas also explained that I didn't need to deploy Mr. eregi() just to search for a string, stristr() will do just fine. Ta very much.

So, did I fail horribly? Pray tell.

› Bio (sort of)

Bio is the personal website of me, Jonas Voss, and this is my blog. I've lived in Dublin, Ireland from 2005-10, currently live in London, and was born and fully customized in Copenhagen, Denmark. I write about anything that comes to mind. Really.
You can send me an email at my first name at my last name . co - if that's how you roll.

Disclaimer: I speak for myself, not my employer. srsly. || This work is licensed under a Creative Commons by-nc-sa License.