gaimung wrote in php

Browser detection

I was testing out browser detection with Javascript and decided that instead of letting people see so much code via view source, I would make the conditionals for browsers in PHP instead. While I was successful in my quest, I was wondering if there was a smarter way of doing this.

This is what I have so far, any new approach to doing this would be helpful and most appreciated. :) But just in short, I basically used $_SERVER['HTTP_USER_AGENT'] and strstr() for a unique term to identify the browser.

For readability sake, I saved a snippet of my source in a text files viewable here.