BrowserHawk 7.0
By Ben Higgins
January 24, 2004
With a number of different web browsers now available to end users, it is important
that web developers customize web page content to be compatible with as many browser
types as possible. You've probably noticed that HTML is not standardized for all
browsers. BrowserHawk, a component offered by cyScape, is a tool that ASP developers
use to retrieve different browser properties. Now cyScape has made this component
available to ASP.NET developers as managed code. The ASP.NET framework does have
its own browser sniffing class, but it is limited in its options, only offering
a fraction of the properties available through BrowserHawk. Below are 4 examples
using the BrowserHawk component and 1 using the built in ASP.NET system.web.HttpBrowserCapabilities
class.
ASP.NET system.web.HttpBrowserCapabilities class:
Dim br As System.Web.HttpBrowserCapabilities
= Request.Browser
Response.Write(br.Platform() & "<br/>" & br.Version() & "<br/>"
& br.Type())
ASP.NET using BrowserHawk 7
This is an example of catching the basic properties of the Internet user (Platform,
Browser type, and Version).
'Import the BrowserHawk namespace.
Imports cyScape.BrowserHawk
'Declare the object. GetBrowser() executes
the command.
Dim browobj = BrowserObj.GetBrowser()
'Response write the properties to the browser.
Response.Write("Your browser is: " & browobj.Browser &
" " & browobj.Fullversion & "<br/>")
Response.Write("Your platform is: " & browobj.Platform & "<br/>")
Response.Write(".NET Framework installed?" & " "
& browobj.NETCLRInstalled.ToString() <br>& "<br/>")
Response.Write(".NET Framework version:" & " "
& browobj.NETCLRVersion & "<br/>")
Response.Write("Supports ActiveX controls?" & " "
& browobj.ActiveXControls & "<br/>")
Response.Write("Supports VBscript?" & " "
& browobj.activexcontrols & "<br />")
Response.Write("Browser data file version:
" & BrowserObj.BDDVersion & ", <br/> dated: "
& BrowserObj.BDDDate & "<p>")
This is an example of the extended BrowserHawk properties:
Imports cyScape.BrowserHawk
'Create an instance of the ExtendedOptions class.
Dim extOptions As ExtendedOptions = New ExtendedOptions
'Specify the additional properties that you want to catch. I've provided a list
of all of the 'properties available below.
extOptions.AddProperties("screensize, browsersize")
'Call the GetExtendedBrowser method which executes the capture.
Dim extbrow = BrowserObj.GetExtendedBrowser(extOptions)
Response.Write("Screen Size is: " & extbrow.width.ToString & " + " &
extbrow.height.ToString & "<br/>")
Response.Write("Browser size is: " & extbrow.widthavail.ToString & " + "
& extbrow.heightavail.ToString & "<br/>")
As you
can see, the code needed for the BrowserHawk 7 component is a little more
extensive, but well worth the additional functionality. Other examples using ASP.NET
written in VB.NET and Classic ASP are shown below.
Classic ASP using BrowserHawk 7
<% 'Create an instance of the
Browserhawk component. This retrieves the
"basic " options.
Set browObj = Server.CreateObject("cyScape.BrowserObj")
'Response write the properties to the browser.
Response.Write "Your browser is: " & browObj.Browser & " " & browObj.Fullversion
& "<P>"
Response.Write "Your platform is: " & browObj.Platform & "<P>" %>
<% 'Retrieve the extended Options.
Set bh = Server.CreateObject("cyScape.browserObj")
'Add the extended properties.
bh.SetExtProperties "screensize, browsersize"
'Execute the capture.
bh.GetExtPropertiesEx 0
Response.write "screen size:" & bh.width & " X " & bh.height & "<br/>"
Response.write "browser window size:" & bh.widthAvail & " X " & bh.heightAvail
%>
The extended properties available with the professional license of BrowserHawk 7:
LANGUSER
MSJVMBUILD
PLUGIN_SVGVIEWER
PLUGIN_FLASH
BROWSERDATETIME
SCREENSIZE
BROWSERDATETIMEMS
COOKIE_PERM
NETMEETINGBUILD
LANGSYSTEM
REFERRER
PLUGIN_CUSTOM
VBSCRIPTENABLED
PLUGIN_QUICKTIME
VBSCRIPTBUILD
COOKIE_BOTH
PLUGIN_CRYSTALREPORTS
PLUGIN_JAVAVER
JAVASCRIPTBUILD
WIDTHAVAIL
WIDTH
|
COLORDEPTH
PLUGIN_MEDIAPLAYER
JAVAVENDOR
PLUGIN_ACROBATVEREX
JAVASCRIPTENABLED
PLUGIN_IPIXVIEWER
PLUGIN_DIRECTORVEREX
PLUGIN_VIEWPOINT
PLUGIN_REALPLAYER
PLUGIN_DIRECTOR
HEIGHT
PLUGIN_AUTHORWARE
CONNECTIONTYPE
JAVAENABLED
CONNECTIONSPEED
TIMEZONEDIFF
TEXTSIZE
PLUGIN_MAPGUIDE
ALL
PLUGIN_FLASHVEREX
HEIGHTAVAIL
|
OPENPORTS
MSXML
PLUGIN_MEDIAPLAYERVEREX
PLUGIN_REALPLAYERBUILD
COOKIE_SESS
FIREWALL
REFERER
COOKIESENABLED
BROWSERSIZE
FONTSMOOTHING
PLUGIN_QUICKTIMEVEREX
JAVAVERSION
SSLENABLED
SSLKEYSIZE
BROWSERBUILD
PLUGIN_ACROBAT
ACTIVEXENABLED
SERVICEPACK
PLUGIN_CITRIX
IMAGESENABLED
|
~Ben
Ben Higgins is a member of the
ORCS Web, Inc. Webteam
- a company that provides managed hosting solutions for clients who develop and deploy their applications on Microsoft Windows platforms. Services include shared hosting, dedicated hosting, and webfarm hosting, with specialty in .Net, SQL Server, and architecting highly scalable solutions.