darft yup
darft yup

Reputation: 39

check if webbrowser is blank

how do I check if the webbrowser is blank?

For example when you start your app, and you have a webbrowser that hasn't been navigated to anything onformcreate. its just blank

Upvotes: 1

Views: 1771

Answers (2)

Warren  P
Warren P

Reputation: 68982

If you haven't loaded something in TWebBrowser, then it is blank. You wrote the code. So you already know if you loaded something, because you called Navigate. And there is an on complete event you could use, and hook that up to an event which sets a "SomethingLoaded" flag to true. When you call navigate, you could set a NavigateInProgress flag, which means, soon, SomethingLoaded will be set.

Update: Daemon_x and Remy both agree that ReadyState is the best solution. They didn't post that as an answer, so I'm updating this one. The uninitialized state is probably the best one.

Upvotes: 2

user532231
user532231

Reputation:

Hard to say, what you exactly mean, but at WebBrowser start homepage different from 'about:blank' may be displayed.

if WebBrowser1.LocationURL = 'about:blank' then
  ShowMessage('about:blank page is displayed ...');

But I would say you want to check, if the homepage is currently displayed

Upvotes: 1

Related Questions