ASP
  Home arrow ASP arrow Page 4 - Detecting Browser Capabilities With Browse...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Moblin 
JMSL Numerical Library 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP

Detecting Browser Capabilities With BrowserHawk
By: Annette Tennison
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 6
    2002-02-19

    Table of Contents:
  • Detecting Browser Capabilities With BrowserHawk
  • What is BrowserHawk
  • The BrowserHawk application
  • Using BrowserHawk
  • BrowserHawk example
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Detecting Browser Capabilities With BrowserHawk - Using BrowserHawk


    (Page 4 of 6 )

    The BrowserHawk ActiveX component can be instantiated in our ASP pages to retrieve the settings of any visitors' web browser (BrowserHawk has great online documentation and examples at this site). The ProgID of the BrowserHawk component is "cyScape.browserObj". As with any other ASP component, it can be instantiated using ASP's Server.CreateObject method:

    <%

    dim objBH

    set objBH = Server.CreateObject("cyScape.browserObj")


    Now that we've got a new instance of the BrowserHawk component, we can query it to retrieve the details of any visitors' browser. If you're using Visual Interdev to create your ASP pages, then you'll have the benefits of Microsoft's Intellisense feature when referring to an instance of the BrowserHawk object:

    Intellisense helps us remember BrowserHawks methods

    As you can see from the screen shot above, the BrowserHawk component exposes dozens and dozens of public methods and members that we can use to our advantage. For example, if I wanted to write the version of the visiting browser as part of my ASP pages output, then I would use the this line:

    Response.Write "Your browsers version is " & objBH.Version

    ... which would output "5.5". If I wanted to make sure that all visitors’ browsers have support for DHTML, then I could use the "DHTML" member of the BrowserHawk object, like this:

    hasDHTML = objBH.DHTML

    if hasDHTML = true then

    Response.Redirect "coolsite.asp"

    else

    Response.Redirect "plainsite.asp"

    end if


    One extremely useful feature of BrowserHawk is the ability to retrieve the details of a users connection speed. The SetExtProperties method tells the BrowserHawk component that we're after an extended property, meaning that the page must be reloaded to extract that specific property. The GetExtPropertiesEx method refreshes the page and retries the details for each property set using the SetExtProperties method. Here's the code to get the connection speed from a visitors browser:

    objBH.SetExtProperties "ConnectionSpeed"

    objBH.GetExtPropertiesEx



    Response.Write "You are connected at " & objBH.Translate("ConnectionSpeed")


    The output from the ASP code above in my browser looks like this (I am connecting to my web server locally, which is why the connection speed is so high):

    Using the ConnectionSpeed BrowserHawk value

    Here's a list of the popular browser features that BrowserHawk exposes through its interface:
    • ActiveXEnabled
    • Browser
    • ColorDepth
    • ConnectionType
    • Cookies
    • DHTML
    • Frames
    • JavaApplets
    • JavaScript
    • MSXML
    • OSDetails
    • ResolveIP
    • SSL
    • VBScript

    More ASP Articles
    More By Annette Tennison


     

    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...







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway