[Qt-interest] how to find all images used by webpage
Richard Baron Penman
richardbp at gmail.com
Fri Jun 18 01:53:33 CEST 2010
thanks very much Sean. That looks just what I am after.
On Thu, Jun 17, 2010 at 6:24 PM, Sean Harmer <
sean.harmer at maps-technology.com> wrote:
> Hi,
>
> On Thursday 17 June 2010 02:43:21 Richard Baron Penman wrote:
> > hello,
> >
> > I am using QWebView to load a webpage. How can I find a list of the image
> > URLs used by a webpage, including background images referenced in
> external
> > CSS?
> >
> > One possibility is to evaluateJavaScript:
> >
> webView.page()->mainFrame()->evaluateJavaScript("document.getElementsByTagN
> > ame(\"img\");");
> >
> > But that feels messy and would miss CSS images anyway.
> > Any ideas?
>
> One possible approach would be to use a customised QNetworkAccessManager
> (QNAM) subclass that logs all image requests. To get an idea on how to do
> this
> see the following blog entries:
>
> http://www.kdedevelopers.org/node/4210
> http://www.kdedevelopers.org/node/4237
>
> Essentially all you have to do is to inherit your own class from QNAM and
> override the createRequest() function. In your specialised version look at
> the
> contents of the request, decide if it is requesting an image or not and
> then
> log it.
>
> HTH,
>
> Sean
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100618/57c61527/attachment.html
More information about the Qt-interest-old
mailing list