Delphi 6
I've got code that loads a Webbrowser control (TEmbeddedWB) via a local HTML file. It works fine for the most part, and has for quite a few years and 1000's of users.
But there's a particular end-user page that has a script that does some sort of Google translate stuff, which makes the page take a really long time to load, upwards of 65 seconds.
I'm trying to make the webbrowser stop/abort/quit so that the page can be reloaded or so that the app can exit. However, I can't seem to make it stop. I've tried Stop, loading about:blank, but it doesn't seem to stop.
wb.Navigate(URL, EmptyParam, EmptyParam, EmptyParam, EmptyParam );
while wb.ReadyState < READYSTATE_INTERACTIVE do Application.ProcessMessages;
The app remains in the ReadyState loop (ReadyState = READYSTATE_LOADING) for quite a long time, upwards of 65 seconds.
Anyone have any suggestions?
If you are using
TWebBrowser
then theTWebBrowser.Stop
or if you wantIWebBrowser2.Stop
is the right function suited for this purpose. Try to do this little test and see if it stops the navigation to your page (if the navigation takes more about 100ms of course :)If you are talking about
TEmbeddedWB
then take a look at theWaitWhileBusy
function instead of waiting forReadyState
change. As the only parameter you must specify the timeout value in milliseconds. Then you can handle theOnBusyWait
event and interrupt the navigation if needed.