From f49a7b49b3418b29820ac0bef85c93531abd73c3 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 6 Oct 2017 07:48:59 -0400 Subject: [PATCH] Updated Static filter syntax (markdown) --- Static-filter-syntax.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Static-filter-syntax.md b/Static-filter-syntax.md index b95ad7f..bec3838 100644 --- a/Static-filter-syntax.md +++ b/Static-filter-syntax.md @@ -63,7 +63,15 @@ To block "popunders" windows/tabs. To be used in the same manner as the `popup` #### `redirect` -To cause a blocked network request to be redirected to a local "neutered" version of the resource. (more documentation will eventually be made.) +To cause a blocked network request to be redirected to a local "neutered" version of the resource. The "neutered" resource must be referenced using a resource token. The resources are defined in [uAssets/filters/resources.txt](https://github.com/uBlockOrigin/uAssets/blob/master/filters/resources.txt). + +The filter syntax for `redirect=` filter option is a subset of ABP-compatible filtering syntax, and is as follow: + + ||example.com^$script,redirect=noopjs,domain=github.com + ||example.com/path/to/image$image,redirect=2x2-transparent.png,domain=github.com + */$script,redirect=noopjs,first-party + +Specifically, notice that the filter **must** start with `||` or `*`, otherwise no redirection directive will be created, though a blocking filter will be created. Essentially, a redirection filter must always have a destination hostname specified, or `*` if the filter is to apply to all destinations. A source hostname must always be specified, so the `domain=` option is mandatory. It is allowed to use `first-party` instead of `domain=`, in which case the source hostname will be that of the destination hostname. ### Cosmetic filters