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

  // This sample is provided under the terms of the BrowserHawk End User
  // License Agreement. Copyright (c) 2003-2006 cyScape, Inc. All rights
  // reserved.

  // This sample demonstrates how to detect whether a vistor is on a 
  // broadband connection.

  // Although we have made this sample very verbose with comments for
  // educational purposes, note that it takes only a few lines of code to
  // detect the Broadband property -  1) the creation of the ExtendedOptions
  // class, 2) using ExtendedOptions to set testing preferences and options,
  // and 3) calling to getExtendedBrowserInfo() to obtain an
  // ExtendedBrowserInfo instance where the answer can be obtained via its 
  // Broadband property.

  // First we create the ExtendedOptions object.  This object is used to set
  // various preferences and options, such as which extended properties we
  // want tested and related testing parameters.
  ExtendedOptions options = new ExtendedOptions();

  // Now we tell BrowserHawk we want to test for Broandband.  If there are
  // other settings you want to check as well, such as disabled
  // cookies/JavaScript, plugins, etc, you can do so concurrently with the
  // Broadband detection by adding the appropriate values to the statement
  // below.  See the ExtendedOptions class in the BrowserHawk documentation
  // for more information.
  options.addProperties("Broadband");

  // OK, let's perform the check for Broadband. See the ExtendedOptions
  // class in the documentation for details on options available such as
  // controlling the background color of the screen and page messages i.e.
  // "Checking your browser. Please wait...". TIP: Set the BGCOLOR parameter
  // below to your site's background color. Otherwise you may notice a color
  // flicker during the test.

  options.setPageMessage("BrowserHawk is checking your connection. Please wait...");
  options.setBodyTag("BGCOLOR=#FFFFFF");
  options.setPageTitle("Please wait...");

  // To avoid an exception, we check that the system executing this
  // example has a Professional or Enterprise Edition license as required
  // for this test.
  // Note: This is NOT needed in your pages, only for this generic sample.
  if (BrowserHawk.getVersion().indexOf("Pro") == -1 &&
      BrowserHawk.getVersion().indexOf("Ent") == -1) {
    out.println("Professional or Enterprise License Required.  ");
    out.println("You are using " + BrowserHawk.getVersion() + ".  ");
    out.println("See <a href='http://www.cyscape.com/order/'>http://www.cyscape.com/order/</a> for upgrade information.");
    return;
  }

  ExtendedBrowserInfo ebi =
    BrowserHawk.getExtendedBrowserInfo(request, response, options);

  // If ebi is null (undefined), we must end the current request here.  The
  // browser will now process the client side tests and call this page back a
  // second time, and this time ebi will not be null.
  if (ebi == null) return;
%>

<html><head><title>BrowserHawk Sample - Broadband Detection</title></head>
<body><font face="arial">
<blockquote>
<h2>BrowserHawk Broadband Detection Demo</h2>
<font size=3>
<b>Test results:  Broadband connection? <%= ebi.getBroadband() %></b>

<P>
<b><a href="broadband.jsp">Retry this test</a></b><P>
<b><a href="index.html">Return to list of other JSP samples</a></b><P>
<b><a href="http://www.cyscape.com/order/">BrowserHawk Pricing and Ordering</a></b><P>
<b><a href="http://www.cyscape.com/">cyScape home page</a></b><P>
</font></blockquote>
</body>
</html>
