[webkit-gtk] Can't find a way to implement content blocking (filtering)

linuxfan at tin.it linuxfan at tin.it
Mon May 3 23:07:00 PDT 2021


Hello all. I'm trying to port my own web browser, which at the moment 
uses Chromium, to webkit2gtk.
But I miss a functionality: the 
possibility to be notified of resource loading, and *optionally cancel* 
the loading.

I connect to the "resource-load-started" signal, so I am 
notified of what is going on. But I don't find a way to cancel the 
request.
A request could be canceled in order to implement content 
blocking.

Yes, I know that there is a whole API just for that 
(filter), WebKitUserContentFilterStore, but that API does not let me to 
do
the following:

1) Open a window which monitors and records, in real 
time, a page loading, with all the requests the page does (blocked and 
not-blocked ones).

2) Inspect the recorded requests, and add a filter 
to a non-blocked one or delete (or temporarily disable) the filter that 
canceled
that resource.

I am using the above method in my browser, and 
I find it very useful because I can precisely know everything about a 
filter rule.

I noticed that there is a very similar signal also in 
webkit, but to use it one has to use an extension which, it seems to 
me, has to be an external library. Even if I could try to write and 
compile a similar library, then the dialog between the library and the 
main application would be quite complicated, I think.

Is there a 
simpler / more direct way? TY in advance.




More information about the webkit-gtk mailing list