Question on DesktopHTMLViewer

Hi,
I have a DesktopHTMLViewer, whose content is updated by means of an external plugin I wrote. After having loaded the page I want to excecute a js but the problem is that the js seems to be executed before the page is completely loaded. Look at the following code. If leave MessageBox “A” (which basically gives some time before ExecuteJavaScript is executed) the code works perfectly. If I comment it, ExecuteJavaScript seems to be executed on the previous version of the page, that is as if LoadPage has not been executed yet. How to solve this?

Thanks,
Davide.

Var s As String = MyExternalPlugin.GetData
NotationView.LoadPage(s, nil)
MessageBox "A"
Var js As String = "document.getElementById('m" + Str(idmove) + "').click();"
NotationView.ExecuteJavaScript(js)

I was thinking of using DocumentComplete event but I don’t need this js to be executed all the times I load a page in the controller.

Is your app a web app?
You must use WebHTMLViewer not DesktopHTMLViewer

It’s a desktop app.

Neverming I managed to solve with DocumentComplete. I created a new class with super DesktopHTMLViewer to make sure that the js is executed only when needed