Skip to content

Filtering page resources #21

@igvk

Description

@igvk

How to use the library for the following example?
||ads.example.com^$domain=example.com|~foo.example.com
(taken from adblockplus.org filters explained)

The page that is loaded is http://example.com or http://subdomain.example.com.
The banner url is, for example, http://ads.example.com/foo.gif.

I try to do something like this (abridged):

Uri url;
Uri.TryCreate(request.Url, UriKind.Absolute, out url); // http://ads.example.com/foo.gif
var filters = allFilters.GetFiltersForDomain(pageUrl.Host); // example.com
foreach (var filter in filters)
{
    if (filter.IsMatch(url, headers))
       return true; // match
}
return false; // no match

But it seems that this isn't how it's intended to be. Am I wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions