Opened 3 years ago

Last modified 7 months ago

#13301 new enhancement

Implement an ad-blocker

Reported by: humdinger Owned by: pulkomandy
Priority: normal Milestone:
Component: Applications/WebPositive Version:
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

It'd be nice to implement a simple ad-blocker that's using a list of domain names of known ad-servers (e.g. from here) and block those. It can be done manually, see this forum post, but it's not exactly convenient.

As some sites don't load and remain blank in Web+ if such a "hosts" file is deployed, this ad-blocker will have to recognize such a situation and retry to load that site without ad-blocking.

Change History (3)

comment:1 by tidux, 18 months ago

Qutebrowser, which already works (mostly) on Haiku, implements such an adblocker.

https://github.com/qutebrowser/qutebrowser/blob/master/qutebrowser/browser/adblock.py

comment:2 by sneaky, 7 months ago

OWB happarently has working adblock in C++: https://github.com/deadwood-pl/OdysseyWebBrowser/blob/odyssey/Source/WebCore/loader/AdBlock.cpp

I don't know a strategy for putting it into HaikuWebKit at this time. For one thing, I don't think I'd be allowed to put a file in Source/WebCore/loader/ because it'd affect upstream tree for no purpose? Also WebKit2 might open up a lot more options? So I'm not sure if the code seen in OWB is useful, but just in case, maybe it's useful to someone.

Falkon has something similar, but oh gosh that's a lot of files: https://github.com/KDE/falkon/tree/master/src/lib/adblock

comment:3 by pulkomandy, 7 months ago

Yes, WebKit now has an API for content filtering, but it is only available in WebKit2. It's probably simpler to use that, and maybe we can even get the Safari version of ublock or adblock to run with it.

Having some changes to webcore in our repo is fine, since we will not directly upstream everyting. We will handle upstreaming on a case by case basis. I've not done much because I didn't have time to work both on keeping our port up to date and handling patches reviews frm upstream, but if more people are starting to contribute, we can reconsider that.

Note: See TracTickets for help on using tickets.