Solved

browser detection script

Posted on 2003-10-21
6
170 Views
Last Modified: 2013-12-24
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

thanks,

justin
0
Comment
Question by:newstandard
6 Comments
 
LVL 9

Expert Comment

by:CFDevHead
ID: 9591402
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;
}
browserRedirect()
0
 

Author Comment

by:newstandard
ID: 9591502
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
0
 
LVL 17

Accepted Solution

by:
anandkp earned 250 total points
ID: 9592402
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 :)

0
Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 
LVL 11

Expert Comment

by:hart
ID: 9596659
anand is right :-)

for server side check
<CFIF FINDNOCASE("MSIE",HTTP_USER_AGENT) EQ 0>            
   not ie
</CFIF>

Regards
Hart
0
 

Expert Comment

by:dvsmind247
ID: 9597264
There's a pretty good custom tag that already does this called <cf_whodat>.

Here's the link:http://www.teratech.com/ColdCuts/cutdetail.cfm?cutid=296

~cheers
dvsmind247
0
 

Expert Comment

by:watersdm
ID: 9608033
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 (http://www.browserhawk.com).

David
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Why addon domain redirects to the original domain? 8 73
Coldfusion Datefield problem 2 122
http to https 3 70
Soundcloud.com 4 47
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question