I'm currently trying to view an image being loaded through a Res://imagename at the point its loaded. In Chromium with a res handler I've been able to do this through the ResourceResponse event however, TWebBrowser does not have a similar function as far as I can tell.
I have been able to latch on to the OnDocumentComplete function and have been able to implement a very inefficient way that looks through the whole of the HTML document once its been created...
procedure TNotesBrowser.TBrowserDocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
var
HTMLDocument2: IHTMLDocument2;
i : Integer;
Item : IHTMLElement;
ImageUrl : string;
begin
HTMLDocument2 := ((FBrowser as TWebBrowser).Document AS IHTMLDocument2);
if HTMLDocument2 <> nil then
begin
for i := 0 to HTMLDocument2.images.length -1 do
begin
Item := HTMLDocument2.images.item(i, 'null') As IHTMLElement;
ImageUrl:=item.getAttribute('src',0);
if ContainsText(ImageURL,'ImageName') then
if Assigned(FCCICONLoaded) then
{ Trigger Event }
FCCICONLoaded(self);
end;
end;
end;
However, this is quite a long process. So has anyone else found an event that acts similar to Chromium's OnResourceResponse() to avoid looking through the document?