browser detection script

i need to make a browser detection script, and instead of trying to analyze all the user-agent strings myself, i figured that someone out there has probably already done the work.  i need it to detect all the latest browsers (i.e. Netscape 7 vs. 6 vs. 4.x)

if you have a script that isn't in CFML it is okay as long as i can see the algorithm you used


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

here something simple and it works

function browserRedirect()
  var ns4 = document.layers;
  var ns7 = document.getElementById && !document.all;
  var ie6 = document.all;
  if(ns4) URLStr = "1.html";
  else if(ns7) URLStr = "2.html";
  else if(ie6) URLStr = "3.html";
  else URLStr = "4.html";
  location = URLStr;
newstandardAuthor Commented:
i need something that can be done using analysis of the UserAgent string because i am doing something server side - that means i can't use javascript
using HTTP_User_Agent -
u'll need to send the information to the server [thru form submit or url ... whatever]

Parse the string & chk for the existance of MSIE [indicates its a IE] else its a NetScape.
there u'll also see the version number ...

I dont know what opera or other browsers show up :)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

anand is right :-)

for server side check
   not ie

There's a pretty good custom tag that already does this called <cf_whodat>.

Here's the link:

Don't waste your time with half-baked, half-working solutions. If browser detection is important to you then spend a few hundred dollars on a reliable, comprehensive solution such as Browserhawk (

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.