gorhill / gorhill/uBlock

Ability to select hostname in element picker when creating cosmetic filters

Open
#2,035 11 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
67.9k
Forks
4.3k
PR merge metrics
No merged PRs in 30d

Description

Read first: https://github.com/gorhill/uBlock/blob/master/CONTRIBUTING.md
### Describe the issue

When creating a filter with the element picker, I have noticed that sometimes it automatically adds 'www.' to the filter, and some times it doesn't. If ublock adds the 'www.' to your filter then your filter only applies on the 'www.site.com' domain and not the higher level 'site.com' domain without the 'www.'.

I was wondering if it is possible to just always drop the 'www.' from the filter creation, I don't see any value in adding it as your filter now won't work on 'https://site.com' but will only work when your browser is on 'https://www.site.com'. However if the filter never has the 'www.' and is only for 'site.com' it will work in both instances depicted above. This would be similar to how ublock doesn't include the 'http://' and 'https://' prefixes when creating a filter.
### Steps for anyone to reproduce the issue
1. Go to 'https://www.google.com' and create a filter with the element picker.
2. Now go to 'https://encrypted.google.com' and observe that your filter created in step 1 doesn't work because your filter only applies to the domain 'www.google.com' and not the 'google.com' domains such as 'encrypted.google.com' or just 'google.com' without the 'www.'
3. Google is just an example, it happens on more than just google.com, when uBlock Origin creates a filter with 'www.' in the address bar it restricts it to only that lower level 'www.' domain so I end up having to strip the 'www.' from each custom filter so it targets the higher level domain. Would be nice if the 'www.' was treated the same way that ublock treats the 'http://' and 'https://' prefix by not including them in the filter creation.

[Removed irrelevant information --gorhill]

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.