Description
Specifies the Web browser for which you want to generate optimized HTML.
Obsolete method
SetBrowser is obsolete and should not be used, because the Web DataWindow technology is obsolete.
Applies to
Syntax
Web DataWindow server component
string dwcomponent.SetBrowser ( string browsername )
Argument |
Description |
---|---|
dwcomponent |
A reference to a Web DataWindow server component. |
browsername |
A string identifying the browser and version. The value should match the string passed to the Web server in the HTTP header. The corresponding server variable is HTTP_USER_AGENT. Sets the value of the HTMLGen.Browser property for the DataWindow object associated with the server component. For information on recognized browsers, see HTMLGen.property. |
Return value
Returns an empty string if successful and the syntax error message from the Modify method if it fails.
Usage
If the DataWindow recognizes the browser identifier, it will generate HTML optimized for that browser. A server-side script can get the browser identifier from the server variable HTTP_USER_AGENT.
This method calls the Modify method of the server component's DataStore to set the property.
Examples
This JSP example identifies the current browser for the component called dwGen:
String browser = (String)request.getHeader ("User-Agent"); dwGen.SetBrowser(browser);
In ASP, you can use the ServerVariables method of the Request object to get the HTTP_USER_AGENT value:
var clientbrowser = Request.ServerVariables("HTTP_USER_AGENT"); dwGen.SetBrowser(clientbrowser);
See also