Sample usage from ColdFusion MX

 

BrowserHawk's powerful capabilities are available for native use with Macromedia ColdFusion MX running on any web server on any platform. All that is required is a working CFMX installation.

 

The following sample demonstrates how to use BrowserHawk4J with ColdFusion MX to perform extended property checks:

 

The Java version of BrowserHawk (BrowserHawk4J) integrates seamlessly with ColdFusion MX pages. For details on how to use BrowserHawk4J from CFMX pages see the samples that are included with the BrowserHawk4J installation.

 

<CFSCRIPT>

req = getPageContext().getRequest();

res = getPageContext().getResponse();

options = CreateObject("java", "com.cyscape.browserhawk.ExtendedOptions");

 

options.addProperties("PersistentCookies, SessionCookies, JavaScriptEnabled, Width, Height, WidthAvail, HeightAvail, Plugin_Flash, Broadband");

 

options.setPageMessage("Checking your browser. Please wait...");

 

options.setBodyTag("BGCOLOR=##FFFFFF"); // TIP: Set this BGCOLOR to match your site's primary background color!

options.setPageTitle("Please wait..."); // TIP: Omit this or pass in an empty string to perform a silent test with no 'please wait message'

 

bh = CreateObject("java", "com.cyscape.browserhawk.BrowserHawk");

ebi = bh.getExtendedBrowserInfo(req, res, options);

</CFSCRIPT>

 

<CFIF NOT IsDefined("ebi")>

<CFABORT>

</CFIF>

 

<html><head><title>BrowserHawk Sample - Detecting Extended Properties</title></head><body>

Persistent cookies enabled? <cfoutput>#ebi.getPersistentCookies()#</cfoutput><p>

Session cookies enabled? <cfoutput>#ebi.getSessionCookies()#</cfoutput><p>

JavaScript enabled? <cfoutput>#ebi.getJavaScriptEnabled()#</cfoutput><p>

Screen resolution: <cfoutput>#ebi.getWidth()# x #ebi.getHeight()#</cfoutput><p>

Available browser window size: <cfoutput>#ebi.getWidthAvail()# x #ebi.getHeightAvail()#</cfoutput><p>

Flash version installed: <cfoutput>#ebi.getPluginFlash()#</cfoutput><p>

Broadband connection? <cfoutput>#ebi.getBroadband()#</cfoutput><p>

</body></html>