Share this page

# TC.addNetworkFilter

Adds a filter for URL requests.

    TC.addNetworkFilter(filters, include, applyTo);

Note:
- This function is only relevant for steps that have a network-related end event, or that do not have any end event.
- You cannot use exclude and include filters at the same time.

## Arguments

Name | Description
--- | ---
filters | (string or RegExp) Filter representing one or more URLs. Separate multiple URLs with a semicolon (;). The URL can include a wildcard (*) which can match 0 or more characters.
include (Optional) | (boolean) Set to true to include URL requests that match the filter; otherwise false (default value).
applyTo (Optional) | Specify the type of request the filter applies to. Possible values: Xhr. Filters XHR requests only. NonXhr. Filters non-XHR requests only. All. Filters all requests (default value).

## Return value

(void) undefined

## Example

From the point that you add this API call, until you call the remove filter or the end of the iteration, TruClient does not wait for requests to get a response unless the URL has a `http://www.myco.com/` prefix.

Copy code

    TC.addNetworkFilter("http://www.myco.com/*", true, "All")

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: