JavaScript Functions > Alphabetical Listing of Web Functions > web.setOption


Sets a Web option.


web.setOption( optionId, optionValue );
Property Name
The option whose value you want to set (case insensitive).
The value of the specified option (case insensitive),

Return Values

Not applicable


The following argument(s) can be parameterized using standard parameterization: optionId, optionValue

General Information

The web.setOption function sets a Web option. It is service function that affects all functions following it, until a new value is specified. When the vuser_init section finishes running, the current options values are saved. The values are restored to the saved values before the start of each iteration.

The following options are supported:

DecodeContent: Enables or disables decoding of server reply content when a "Content–Encoding" header is sent by the server. Currently it affects decompression only. The available values are "Yes" and "No".

DownloadNonHtmlresources: Set to "Yes" to start or resume downloading non–HTML resources (for example, images) in a Web page during replay. Set to "No" to stop. This option gives you the opportunity to override the Browser Emulation option in the Vuser's Run–Time Settings, Download non–HTML resources. This option can help when debugging. At certain points in the code you may want to stop downloading resources to save time.

LRW_OPT_DISPLAY_IMAGE_BODY: Set to "Yes" to display the response and request body for images. Set to "No" to restore the default behavior of not displaying the bodies.

IgnoreCookieExpiresAttribute: Set to "Yes" to ignore the "expires" attribute of all cookies. Set to "No" to restore the default behavior of not processing expired cookies.

MaxRedirectionDepth: The maximum redirection depth. This option has the same effect as specifying MaxRedirectionDepth in the default.cfg file of a script. The value of this option must be a character string representing a decimal number.

LRW_OPT_NON_GUI_FRAMES_SCHEME_JAVASCRIPT: In low level (HTML and url) scripts, frames defined "<FRAME src=JAVASCRIPT..> can be ignored when calculating the relative frame id by setting this option to "No". The default is "Yes". This option does not apply to GUI level scripts.

LRW_OPT_HTML_CHAR_REF_BACKWARD_COMPATIBILITY: This option is for expert users. There are two types of web functions: low–level (HTML and url) and GUI level. Unicode and certain character combinations are treated differently at the two levels. By setting this option to LRW_OPT_VALUE_NO, you can force GUI level character handling. Set the option back to LRW_OPT_VALUE_YES after the calls for which you wish to force GUI level handling. The default is LRW_OPT_VALUE_YES.


// Disable decoding

// Enable decoding
web.setOption("DecodeContent", "Yes");

// Disable redirection. If redirection is required in following action functions, a warning is issued.
web.setOption("MaxRedirectionDepth", "0");

// Set the maximum redirection depth to 10.
web.setOption("MaxRedirectionDepth", "10");