Question

I'm using a TWebBrowser in my Delphi app. When an Internet Explorer Script Error dialog pops up it blocks automated refreshes ("the requested resource is in use"). Is there a way to automagically close the error dialog?
TIA
Steven

edit
One possible solution is to use the Mozilla ActiveX Control instead of IE's (Firefox never shows the error), but this has its own problems.

Was it helpful?

Solution

Set the TWebBrowser Silent property to True in the Object Inspector or in code:

  WebBrowser1.Silent := True;
  WebBrowser1.Navigate2(sURl);

It will prevent the error dialog to pop up, so you don't have to close it ;-)

OTHER TIPS

You could close the dialog by clicking its button in code but probably a better way is to prevent the error that causes the dialog to display in the first place.

I'm only guessing here but I think you can get this error when you're trying to refresh the page before it's finished loading. The Navigate2 method is asynchronous, ie. it returns immediately and the browser continues loading the page in a background thread. When the document is loaded the browser triggers the OnDocumentComplete event - which you should handle to update your state variable. Don't try to call Navigate2, Refresh or Refresh2 before the current document has been loaded completely.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top