![]() Registered Member ![]()
|
Hi all,
I would like to install "hooks" on the contents of the web page received by a KHTML part so I can alter the web page before it is being passed to the html renderer. I would like to implement this as a Konqueror extension if possible (KPartPlugin). So I looked into AdBlock extension to see how it is "deletes" elements from the page. I was totally disapointed on how it does that since element filtering is done at KHTML level and this extensions only add filters to the KHTML part. Is it possible for KHTMLPart to pass the contents of the page to a plugin for "rewrite" before rendering it ? A sort of a proxy for Konqueror written as an extension ... And is it possible for a custom extension to display custom settings page in KHTMLSettings ? (this does not seem possible after looking at KHTMLSettings class, everything is hard coded). Thanks |
![]() Administrator ![]()
|
What exactly are you trying to implement here?
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
I'd like to port some firefox extensions to konqueror (or create ones that do similar jobs). For example, I think various add blocking extensions modify the DOM tree of the webpage in order to hide elements. So is it possible to modify the page before being sent to rendering engine ?
|
![]() Administrator ![]()
|
I have checked with the KHTML developers and they have noted that it is probably not possible to implement this given the current state of the codebase (ie. the hooks in question don't exist at this time). They could exist in the future, but you might have to write the needed code to add them and submit a patch.
However, they also noted that you can alter the page once it has loaded, so you may want to look into that instead. Please see http://quickgit.kde.org/index.php?p=kde ... mficon.cpp for an example.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
Thanks for the answer.
However, I don't find any part of the code where the page is modified: the page is 'parsed' to search for some elements and then they are added to a context menu. The only modification to the KPart is the addition of the icon. Is this right ? So for the moment the best way to implement what I want is through a real proxy which triggers some external commands to 'rewrite' the page. This will be slower and somewhat unsafe. But maybe instead of looking to do this inside KHTML, I may do it inside the KIO http (lxr.kde.org/source/kde/kdelibs/kioslave/http/http.h) but this will impact all applications using KIO for http, not just konqueror. I will continue thinking about this. |
![]() Administrator ![]()
|
Most of what I posted was the advice of the KHTML developers. I would recommend sending an email to the kde-devel@kde.org mailing list, which may be able to point you to other examples.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft