Skip to content

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

Closed

Description

@AdamWr

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.

Activity

  1. changed the title [-]Improve prevent-fetch — add ability to set random response content[/-] [+]Improve 'prevent-fetch' — add ability to set random response content[/+] on Oct 21, 2024
  2. Yuki2718 commented on Apr 13, 2025

    @Yuki2718

    Any news on it? japscan now checks if the response has at least 100 characters (they'll change in a few hours). This will also be useful for AdguardTeam/AdguardFilters#201832

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions