Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Invoking JavaScript in a SHDocVw.WebBrowser from QM?
#1
Hi -

I have a web page (a SHDocVw.WebBrowser control in a dialog) that is loading nicely in QM. When it loads I get a DocumentComplete callback; In that callback I get a SHDocVw.IWebBrowser2 object that I can walk with Document.getElementById() to get a particular DOM element and I can attach a OnPropertyChange callback to that.

So - any time the specified element changes in the web page I get a callback. This is all working smoothly.

I was wondering what the cleanest way would be to go in the other direction - is it possible to call InvokeScript or some other function where I could invoke a JavaScript function from inside of QM? I don't see anything in the API for this.
When I try this:
Code:
Copy      Help
SHDocVw.IWebBrowser2 wb
wb.Document.execCommand("blah" "true" 0)
I get a Javascript error from inside the browser - so I think I'm close. (I have a JavaScript function named "blah").
Another alternative might be just to write out DOM elements and use jQuery change() callbacks to generate JavaScript calls. But I'd rather call JavaScript directly if I can.

Any help appreciated :-).


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)