getVersion(), "Ent") >= 0; $isPro = strpos($BrowserHawk->getVersion(), "Pro") >= 0; // If Standard Edition then do not set up for or perform any extended // property tests, as these are not supported the Standard Edition. if ($isPro || $isEnterprise) { // Request a complete test. This includes all extended properties that // are testable at the current BrowserHawk licensed edition. That is, // a Professional license will test all Pro-level features while an // Enterprise license will test all Pro and Enterprise-level features. $options->addProperties("complete"); // Assign a stable of ports to check $options->setPortsToCheck("80,443,554"); // Some properties we'll test only if specifically requested $options->removeProperties("FontsInstalled, Plugin_Custom, PopupsBlocked, ConnectionSpeed, JavaVendor, JavaVersion, Plugin_JavaVer, MSJVMBuild, OSName, OSVersion, OSArch"); // If the user sends a "doSpeed" parameter, we test speed detection if (isset($_GET["doSpeed"])) { $options->addProperties("ConnectionSpeed"); } // If the user sends a "doJvmd" parameter and this is an Enterprise // Edition license, we test applet properties if (isset($_GET["doJvmd"]) && $isEnterprise) { $options->addProperties("JavaVendor, JavaVersion, Plugin_JavaVer, MSJVMBuild, OSName, OSVersion, OSArch"); } // Now choose a request type; default is AUTO // See the documentation of the ExtendedOptions class for more // information on these request types and how they differ. // Note that in the majority of cases the default of REQUEST_TYPE_AUTO // is recommended. $options->setRequestType($options->REQUEST_TYPE_AUTO); // One common reason to use options is to set a "please wait" message. // Here we set the value to an explanation string, for purposes of // example. The default is "". $options->setPageMessage( "Now determining extended properties of this browser, please wait..."); // Comment in the following if JVMDetector.class is in a different // directory than this PHP, and specify where the class is to be found. //$options->setJVMCodeBase("/some/path/to/shared/files"); $einfo = bhextended($options); } ?>
All BrowserHawk Properties Test Results
The following is information on your browser's capabilities
as detected by BrowserHawk (getVersion() ?>)User agent:
Browser Definition File version: getBDDVersion() ?>; Dated: getBDDDate() ?>
"; $tdColor2 = "
"; ?>
Basic Properties for: getBrowser() ?> getFullversion() ?> getPlatform() ?> toString() to see if it // complains about "CountryHawk" being not available. If it // complains, we know it's not present, and if not we're good to go. if (strpos($info->toString(), "CountryHawk") === false) { $val = $info->getCountry(); } else { $val = "Requires CountryHawk"; } } else { // Note: In this sample we are enumerating through all the basic // properties and dynamically accessing each of the properties // values through the get() method to make it convenient to display // all results. However it is important to note that in normal // circumstances you would NOT use the get() method to get the // value since this returns the result as an object and is // internally less efficient. Instead you should directly // reference the property you are interested in. // For instance use this: // $browType = $info->getBrowser(); // do this // $majorver = $info->getMajorver(); // do this // Instead of this: // $browType = $info->get("Browser"); // not this // $majorver = $info->get("Majorver"); // not this $val = $info->get($propertyName); } echo " Property Value ${tdColorToUse} $propertyName${tdColorToUse} "; boolprint($val); echo " "; } ?>
toString() === $UNSUPPORTED->toString()) { echo "No extended information is available. Only Netscape, " . "Mozilla, IE, Opera and Safari clients are supported.
"; } else if ($einfo->getJavaScriptEnabled() === false) { echo "No extended information is available. This client has " . "JavaScript disabled.
"; } } // We'll print the table below regardless of the above warnings ?>
Extended Properties here to test"; // If isPro, intentionally fall through to translate() } else if ($propertyName == "ConnectionSpeed" && !isset($_GET["doSpeed"])) { $val = "Click here to test"; } else if ($propertyName == "PopupsBlocked" && $isEnterprise) { $val = "Click here to test"; } else if ($propertyName == "FontsInstalled" && $isEnterprise) { $val = "Click here to test"; } else { $val = $einfo->translate($propertyName); } echo " Property Value ${tdColorToUse} $propertyName${tdColorToUse} $val "; } ?>
Return to list of other PHP samples
BrowserHawk Pricing and Ordering