SetBrowser method (DataWindows)
Description
Specifies the Web browser for which you want to generate optimized HTML.
Controls
DataWindow type |
Method applies to |
---|---|
Web |
Server component |
Syntax
[Web DataWindow server component]
1 |
string <span>dwcomponent</span>.<span>SetBrowser</span> ( string <span>browsername</span> ) |
Argument |
Description |
---|---|
dwcomponent |
A reference to a Web DataWindow server |
browsername |
A string identifying the browser and Sets the value of the HTMLGen.Browser property for the DataWindow For information on recognized browsers, see HTMLGen.property. |
Return Values
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.
For information about using the Web DataWindow, see the DataWindow Programmers
Guide.
Examples
This JSP example identifies the current browser for
the component called dwGen:
1 |
String browser = (String)request.getHeader<br>  ("User-Agent"); |
1 |
dwGen.SetBrowser(browser); |
In ASP, you can use the ServerVariables method of the Request
object to get the HTTP_USER_AGENT value:
1 |
var clientbrowser = |
1 |
   Request.ServerVariables("HTTP_USER_AGENT"); |
1 |
dwGen.SetBrowser(clientbrowser); |