Javascript variable from WebBrowser control
-
Hi folks I'm trying to get the javascript variable in the HTML page loaded in WebBrowser control through IHTMLDocument2 interface. In VB6 it was simple: "WebBrowserInstance.Document.parentWindow.variableName". But, I stuck in MSHTML interfaces. Could somebody help me with that? Thanks
-
Hi folks I'm trying to get the javascript variable in the HTML page loaded in WebBrowser control through IHTMLDocument2 interface. In VB6 it was simple: "WebBrowserInstance.Document.parentWindow.variableName". But, I stuck in MSHTML interfaces. Could somebody help me with that? Thanks
You may get variable in this way :
IHTMLDocument2 document2 = (IHTMLDocument2)axWebBrowser1.Document; object variable= document2.parentWindow.GetType().InvokeMember ("variableName", BindingFlags.GetProperty, null, document2.parentWindow, new Object [] {});
The snippet below shows how to set the variabledocument2.parentWindow.GetType().InvokeMember ("variableName", BindingFlags.SetProperty, null, document2.parentWindow, new Object [] {"New value"});
DevIntelligence.com - My blog for .Net Developers