Overview of BrowserHawk

 

BrowserHawk makes it easy for professional web developers to build high impact sites that reach the widest possible audience, while ensuring a Flawless Web Experience for every visitor regardless of their browser settings and system capabilities.

 

BrowserHawk consists of both a visual browser definition editor and a .NET, ActiveX, and Java server-side component.

Using browser detection in your web scripts consists of three main steps:

1. Defining browsers and their capabilities (BrowserHawk Editor). Note that this is handled for you by cyScape, although you have full control over customizing these definitions if you wish.

2. Creating a browser object in your web script (using the .NET, ActiveX, or BH4J Java component).

3. Using logic in your web scripts to take specific actions based on the capabilities (or lack thereof) of the visiting browser (ASP.NET, classic ASP, ColdFusion MX, JSP, servlets, or other languages which support creating these server-side objects).

BrowserHawk Editor

The BrowserHawk Editor is used to view, create, test, and maintain browser capability information. This definition information is then saved in a special file format known as a Browser Definition File (BDF). BrowserHawk comes with cyScape’s BDF, named maindefs.bdf which contains all the browser definitions you will likely need. In that case, you will have little need to use the BrowserHawk Editor beyond viewing our definitions for your own knowledge. If on the other hand you have specialized needs in your browser detection, you use the BrowserHawk Editor to make the desired customizations.

BrowserHawk .NET and ActiveX Components

The BrowserHawk .NET and ActiveX components are used in your web scripts to access the browser capability information stored in your Master BDF file. When you create an instance of the BrowserHawk components in your scripts, BrowserHawk automatically identifies which web browser is being used to execute the script by examining the browser’s user agent. If a match is found, a BrowserHawk object is returned which contains all of that browser’s capabilities. Otherwise, the default BrowserHawk object is returned with all the capabilities set to default values.

BrowserHawk4J JavaBean

The BrowserHawk4J JavaBean is used in from any server-side Java™ environment to access the browser capability information stored in your maindefs.bdd file, located in your CLASSPATH or web-inf folders. When you create an instance of BrowserHawk4J class library, BrowserHawk automatically identifies which web browser is being used to execute the script by examining the browser’s user agent. If a match is found, a BrowserHawk4J object is returned which contains all of that browser’s capabilities. Otherwise, the default BrowserHawk object is returned with all the capabilities set to default values.

Logic in Your Web Scripts

After creating a BrowserHawk object in your web script, you then use the object’s properties to determine which capabilities a browser has, and take the appropriate actions based on that information. For example, let’s say you want to redirect people using a browser that does not support frames to a different web page. In this case, you would check the frames property of the BrowserHawk object, and redirect them to the appropriate web page. The following examples demonstrates this:

 

frametest.asp (Active Server Pages example)

<%

'Create a BrowserHawk ActiveX object

Set browObj = Server.CreateObject("cyScape.browserObj")

if browObj.frames = True then

response.redirect "/noframes.asp"

end if

%>

<HTML>... load frameset here ... </HTML>

 

frametest.jsp (Java Server Pages example)

<%@ page import = "com.cyscape.browserhawk.*" %>

<% BrowserInfo b = BrowserHawk.getBrowserInfo(request); %>

<% if (! b.getFrames() )

response.sendRedirect("/index_noframes.jsp"); %>

 <HTML> ... load frameset here ... </HTML>

 

See Also:

BrowserHawk features at a glance

Important concepts in BrowserHawk

Introduction to the BrowserHawk Editor

Working with the BrowserHawk component

Tips and technique in using BrowserHawk