Skip to content
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

Improve 'prevent-fetch' — add ability to set random response content #416

Open
AdamWr opened this issue Apr 2, 2024 · 0 comments
Open
Assignees
Labels
enhancement Improvement of existent feature Priority: P4

Comments

@AdamWr
Copy link
Member

AdamWr commented Apr 2, 2024

Similar to - #199 (comment) but for prevent-fetch.

Also adding Content-Length header to response would be a good idea, related to - AdguardTeam/AdguardFilters#175797 and AdguardTeam/AdguardFilters#176137

Steps to reproduce:

  1. Add this rule:
example.org#%#//scriptlet('prevent-fetch', 'pagead2.googlesyndication.com')
  1. Go to - https://example.org/
  2. In browser console run:
(async () => {
    const ads = await fetch('https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js');
    const contentLength = (await ads.text()).length;
    const contentLengthHeader = Number(ads.headers.get('Content-Length'));
    if (!ads.ok || contentLength < 100 || contentLengthHeader < 100) {
        alert('Ads are blocked!');
    }
})();

Alert will be displayed.

@adguard-bot adguard-bot changed the title Improve prevent-fetch — add ability to set random response content Improve 'prevent-fetch' — add ability to set random response content Oct 21, 2024
@slavaleleka slavaleleka added the enhancement Improvement of existent feature label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement of existent feature Priority: P4
Projects
None yet
Development

No branches or pull requests

4 participants