Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to determine total size of web page in TWbBrowser?

Status
Not open for further replies.

JohnnySmid

Programmer
Apr 13, 2007
1
CZ
Hallo,
I need to determine total size (i mean data size, not widht and height ;) of the web page that is loaded in TWebBrowser...
I tried WebBrowser1.Document.FileSize but it always causes an error.

Can anyone help me please?
 
Trying to read FileSize before the page has finished loading will give you an error. Just wait until the page has completed loading and it should(!) be okay

Code:
procedure TestGetSize;
var
  URL: string;
  Size: string;
begin
  URL := '[URL unfurl="true"]http://www.google.co.uk';[/URL]
  WebBrowser1.Navigate(URL, EmptyParam, EmptyParam, EmptyParam, EmptyParam);

  while WebBrowser1.ReadyState <> READYSTATE_COMPLETE do
    Application.ProcessMessages;

  Size := WebBrowser1.OleObject.Document.FileSize;
end;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top