I actually implemented this some time ago, in order to extract a meta
tag from an htmldocument you need to go through the documentelement
property of ihtmldocument3, the following code will go through all the
meta elements in a webpage
var
i: Integer;
Doc: OleVariant;
begin
Doc := MyWebBrowser2.Document;
for i := 0 to Doc.DocumentElement.all.Length -1 do
begin
if Supports( Doc.DocumentElement.all.Item(I,0), IHTMLMetaElement) then
begin
// this is a meta tag, cast it to IHTMLMetaElement to get info
from it
end;
end;
end;
Alternatively you can also use ihtmldocument3 getElementsByTagName to
get only the meta tags
var
Doc: OleVariant;
MetaCollection: IHTMLElementCollection;
begin
Doc := MyWebBrowser2.Document;
MetaCollection := Doc.GetElementsbyTagName( 'meta' );
// Metacollection is a htmlelementcollection that contains all the
meta tags in the webpage
end;
Please note that MyWebBrowser2 is supposed to be a IWebBrowser2
implementation