Solved

browser detection script

Posted on 2003-10-21
6
166 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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
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
Grub Broken on Ubuntu 16.04 LTS, Mate 1.14 GUI 5 221
Website Test Question 6 115
How can I install php on a ngxin server on droplet 5 134
listing all functions in JavaScript 19 201
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…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

770 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