setOption Method
Collapse the table of content
Expand the table of content

setOption Method


Sets one of the following options:

  •            SXH_OPTION_URL_CODEPAGE         

  •            SXH_OPTION_ESCAPE_PERCENT_IN_URL         


  •            SXH_OPTION_SELECT_CLIENT_SSL_CERT         

For more information about these options, see Remarks.

oServerXMLHTTPRequest.setOption(option, value);


The option whose value is to be set.


The value to which the specified option is to be set.



The option whose value is to be set.


The value to which the specified option is to be set.


Value returned if successful.

The following table lists the options available to the setOption method.


SXH_OPTION_URL_CODEPAGE: By default, CP_UTF8 is the code page used to convert the Unicode URL string (specified in the open method) to a single-byte representation.

The SXH_OPTION_URL_CODEPAGE option allows the client to override this default with a different code page value. The client should specify an unsigned integer value for the code page.


SXH_OPTION_ESCAPE_PERCENT_IN_URL: By default, escaping unsafe ANSI characters in the URL (for example, " " -> "%20") does not escape the % character itself.

The SXH_OPTION_ESCAPE_PERCENT_IN_URL option allows the client to change this behavior. The client should specify a Boolean True/False value for this option.


shx.setOption(2, shx.getOption(2)


To turn off a flag, you subtract it from the default value, which is the sum of all flags. For example, to catch an invalid date in a certificate, you turn off the SXH_SERVER_CERT_IGNORE_CERT_DATE_INVALID flag as follows:

All certificate errors.

The date in the certificate is invalid or has expired.

Mismatch between the visited hostname and the certificate name being used on the server.

Malformed certificate such as a certificate with no subject name.

Unknown certificate authority


shx.setOption(3, "MSXML")


Option –1, SXH_OPTION_URL, is a read-only return value, and can therefore not be set by the setOption method. For more information about this option, see getOption Method.

Implemented in: MSXML 3.0 and MSXML 6.0

© 2016 Microsoft