-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an ability to apply cosmetic rules to specific URLs only #124
Comments
Here is a proposal for the path
Syntax
, where the
Examples
|
How would we escape |
Just the same, for example: |
Questions:
|
As for wildcards, they can be expressed by regular expressions so I think we may not support them. |
|
|
|
Ok, I've updated the spec #124 (comment) |
@sxgunchenko probably the the modifier should be different then since it matches uri now. |
@ameshkov But it is taken entirely from "path" HTTP field :) IMHO "uri" may confuse because it is typically means entire URI including authority, and also any URN like "urn:ietf:rfc:9000" is URI too :) |
@sfionov well, okay then, let it be |
After review, the spec #124 (comment) has been updated |
This would've been a game changer back in 2018, when humans still used Internet Explorer 11 to a small extent. That way I could've used entries like |
About the comma as a separator for multiple options: How would a literal comma be represented in this case? Also I was wondering if someone might want support for exceptions. e.g. |
The same question about a literal |
Would this syntax support whitelist mode ? For example, I would like to block google product ads everywhere except on path such as |
@uBlock-user this can be achieved with two rules:
@sxgunchenko can we add a unit test for this use case? |
@ameshkov We already have one in the corresponding PR
I think it would be better to add a separate modifier that supports full URLs. As for the special characters, if you want them to be a part of a modifier value, they must be escaped with |
@sxgunchenko thanks.
It also occurs to me now that the closing bracket would also have to be percent-encoded in a URL, which means the value specified here would also be encoded similarly. It would never occur in a filter between the Are IPv6 addresses supported in cosmetic filters?
|
It seems like it depends on the software which makes a request. For example, a browser (at least chrome and FF) won't encode the request to http://example.com/?some=1[2 either entered in the address bar or encountered on an HTML page (like
They should be, but because of a bug they aren't matched |
@sxgunchenko I propose to update the specification:
This example description is not correct. According to docs Also it seems that using a $domain modifier with a list of domains is impractical. This can be added to the spec too. |
Yup, it seems like the remainings of the previous logic description. The spec has been updated.
It is already there: https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#non-basic-rules-modifiers-domain |
Initially, it was discussed here:
AdguardTeam/AdguardForWindows#1992
We need the ability for cosmetic rules to be limited to specific locations or pages on websites.
First of all, for this, we need to be able to specify "modifiers" for cosmetic rules.
For instance, we could do something like this:
[path=/this/is/some/page]example.org##banner
In this example, the path modifier value is basically a basic filtering rule's pattern that accepts the same special characters (
||^*
) and is matched against the page URL.What are your thoughts on this?
The text was updated successfully, but these errors were encountered: