PDA

View Full Version : modifying webkit content before loads



rbp
16th September 2010, 09:25
I am using QtWebkit.QWebView as a basic browser and am trying to modify the HTML content before it starts downloading media and rendering.

The loadStarted signal is emitted before downloading the webpage, loadProgress during rendering, and loadFinished after rendering, which don't seem to help.

Can this be done?

e8johan
16th September 2010, 15:04
As I see it, there is no way that you can modify something that don't have. So, modifying the HTML before you've downloaded it sounds impossible.

What you could do is to use a custom QNetworkAccessManager which your QWebView uses. That way, you can monitor any HTML before it reaches the QWebView.

rbp
17th September 2010, 05:00
yeah so obviously I am not trying to modify the HTML before it is downloaded...

I want to modify it to remove certain images, flash, etc. I'll check out QNetworkAccessManager.

rbp
17th September 2010, 07:00
Found some useful articles here:
http://www.kdedevelopers.org/node/4210
http://www.kdedevelopers.org/node/4237