Utils.addAutoFilter

Adds a filter to one of the lists that either blocks certain URLs (denylist), or allows only specific URLs (allowlist).

The URL of each HTTP request is checked first against the denylist, and then the allowlist. HTTP requests that do not pass the check are blocked.

Utils.addAutoFilter(url, isIncluded);

Arguments

Name Description

url

(string or regexp) String or regular expression that represents the URL.
isIncluded(boolean) Set to true to add the URL to the allowlist, or false to add the URL to the denylist.

Return value

A promise that is fulfilled with undefined upon success.

Examples

The specified domain is added to the allowlist. All other domains are blocked.

Copy code
(async ()=>{
    await Utils.addAutoFilter("https://www.myco.com/*", true);
})();