GetExtendedBrowser Method (.NET)

 

Returns: An immutable BrowserObj instance containing extended property values for the associated browser. This is a static method.

 

Syntax:

 ExtendedBrowserObj extBrowObj = BrowserObj.GetExtendedBrowser(ExtendedOptions options);

 ExtendedBrowserObj extBrowObj = BrowserObj.GetExtendedBrowser(long pluginTypes);

 ExtendedBrowserObj extBrowObj = BrowserObj.GetExtendedBrowser(long pluginTypes, bool keepReferrer);

 ExtendedBrowserObj extBrowObj = BrowserObj.GetExtendedBrowser(long pluginTypes, bool keepReferrer, string bodyTag, string pageTitle, string pageMessage);

 

Like the GetBrowser method, the GetExtendedBrowser method is one of the most fundamental methods in BrowserHawk. Whereas GetBrowser obtains a BrowserObj instance, GetExtendedBrowser is used to obtain an immutable instance of the ExtendedBrowserObj class. The ExtendedBrowserObj class which represents the extended browser capabilities for a particular browser.

 

This method must be used within the context of an ASP.NET page so that BrowserHawk can obtain the HttpContext associated with the current visitor.

 

Shown in the syntax above are various signatures for this method. The recommended approach for maximum flexibility and readability of your code is to create an ExtendedOptiions class, set its properties as desired, and to pass the ExtendedOptions class into GetExtendedBrowser. However you can use the other method signatures shown as a shortcut if you prefer.

 

C# Example:

<%

ExtendedOptions options = new ExtendedOptions();

options.AddProperties("JavaScriptEnabled");

ExtendedBrowserObj extBrow = BrowserObj.GetExtendedBrowser(options);

%>

<html>

JavaScriptEnabled: <% Response.Write(extBrow.JavaScriptEnabled); %>

</html>

 

Note: Extended property information is exposed through the ExtendedBrowserObj class. For basic property information see the BrowserObj class.

 

Note: To use the GetExtendedBrowser method you must have either the Professional or Enterprise Edition of BrowserHawk and use the component from an ASP.NET page or other environment where the HTTP context is available.

How the GetExtendedBrowser method works 

When the GetExtendedBrowser method is invoked, BrowserHawk silently sends a test page to the user's browser, determine the values for the properties requested (as set by the instance of the ExtendedOptions class passed in), and then continues with the loading of your page.

 

The GetExtendedBrowser method MUST be called before the <HTML> tag is sent to the browser. Therefore the best place to invoke this method from is the top of your ASP.NET script, preferably as the first ASP code to execute in the script. If using VS.NET Code Behind pages, call GetExtendedBrowser from within the first lines of your Page_Load event. Any line of your script that comes after calling the method can then access these properties to get the appropriate values. If you try accessing the extended properties before calling this method, the extended properties will contain only their default values.

 

Tip: See the section on Detecting Extended Properties for an important discussion on the various requestTypes that can be used when performing extended property checks.

Important tips and considerations for the GetExtendedBrowser method:

 

See Also:

About the BrowserObj class (.NET)

About the ExtendedBrowserObj class (.NET)

ExtendedOptions class (.NET)

PageMessage Property