Home arrow ASP arrow Page 3 - Detecting Browser Capabilities With BrowserHawk
ASP

Detecting Browser Capabilities With BrowserHawk


One of the constant non-niceties when developing web sites is that of browser incompatibility. In this article Annette looks at Cyscape's BrowserHawk component, which can be used to find out the capabilities of any visitors web browser. Annette talks about the component in general, and also shows us a complete working example that detects flash, MSXML, connection speeds, and more.

Author Info:
By: Annette Tennison
Rating: 5 stars5 stars5 stars5 stars5 stars / 17
February 19, 2002
TABLE OF CONTENTS:
  1. · Detecting Browser Capabilities With BrowserHawk
  2. · What is BrowserHawk
  3. · The BrowserHawk application
  4. · Using BrowserHawk
  5. · BrowserHawk example
  6. · Conclusion

print this article
SEARCH DEVARTICLES

Detecting Browser Capabilities With BrowserHawk - The BrowserHawk application
(Page 3 of 6 )

BrowserHawk is installed as a Windows NT service. It comes bundled with the BrowserHawk application, which allows us to view the definitions and properties of each web browser. Each browser definition contains the details of several properties that are unique to that browser, such as its version string and version number. The BrowserHawk application looks like this:

The BrowserHawk Application

BrowserHawk comes with browser definitions for 32 different browser types, including those for Netscape, Microsoft, Oracle, Lynx, MCSA Mosaic, WebTV, Konqueror, Mozilla and more. If you so desire, you can also create your own browser definition. This could come in handy if you only require a certain amount of features from a visitor's browser, and not a complete set of features. For example, you might create a new browser type called "MyBrowser". In order for a visitor to view your site, their browser must match all features of the MyBrowser type, which could include support for MSXML, DHTML, JavaScript and cookies.

So where exactly does BrowserHawk get the details of each visitors browser from? Well, whenever we use our web browser to visit a web site, our browser sends that site a set of details as part of its request header. We can view all of our browser's header variables by iterating through ASP's Request.ServerVariables collection, like this:

<%

for each item in Request.ServerVariables

Response.Write "<b>" & item & ":</b> "

Response.write Request.ServerVariables(item) & "<br>"

Next

%>


Here's the output from the code above in my browser (I run Internet Explorer 5.5 on a Windows 2000 server):

My web browsers header details

I've circled the HTTP_USER_AGENT variable in my screen capture above. BrowserHawk uses this value as the basis for selecting which browser any visitor that comes to our site is using. The "MSIE 5.5" string tells BrowserHawk that I am running Internet Explorer 5.5, and the "Windows NT 5.0" tells BrowserHawk that I'm running Windows 2000.

If you take the code snippet shown above and run it through your browser, you'll notice several other variables in the list that relate to the details of your web browser, namely HTTPS, PATH_INFO, REMOTE_ADDR, and HTTP_COOKIE.

Luckily, when we use the BrowserHawk component in our ASP pages, we don't have to analyze the visitors’ browser manually. All we have to do is query a new instance of the BrowserHawk component for the values we're after. We will proceed to do that now.
blog comments powered by Disqus
ASP ARTICLES

- Central Scoreboard with Flash and ASP
- Calorie Counter Using WAP and ASP
- Creating PGP-Encrypted E-Mails Using ASP
- Be My Guest in ASP
- Session Replacement in ASP
- Securing ASP Data Access Credentials Using t...
- The Not So Ordinary Address Book
- Adding and Displaying Data Easily via ASP an...
- Sending Email From a Form in ASP
- Adding Member Services in ASP
- Removing Unconfirmed Members
- Trapping HTTP 500.100 - Internal Server Error
- So Many Rows, So Little Time! - Case Study
- XDO: An XML Engine Class for Classic ASP
- Credit Card Fraud Prevention Using ASP and C...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials