C# WebBrowser using JavaScript
-
I have a WebBrowser component on a form, and it interacts with a site (www.zoomin.co.nz)though Javascript. The Javascript contains functions such as GPoint gpt= GMap.getCenterLatLong() In my application I need to be able to call that function in Javascript and find out the values for gpt (of the two floating point values that make it up) in my C# code. Thanks
-
I have a WebBrowser component on a form, and it interacts with a site (www.zoomin.co.nz)though Javascript. The Javascript contains functions such as GPoint gpt= GMap.getCenterLatLong() In my application I need to be able to call that function in Javascript and find out the values for gpt (of the two floating point values that make it up) in my C# code. Thanks
If you look inside the Document property there is a method called Invoke or InvokeScript (something like that anyway), you can pass the function name and parameters of the JavaScript function to invoke through this. As for getting the results it's probably documented in the documentation about the InvokeScript function. (This may not be completely accurate but I do know that such a method does exists since I've used it but for reasons given in my sig I won't guarantee the accuracy :-D)
As of how to accomplish this I wouldn't have a clue at the moment and I'm too lazy to google it
-
If you look inside the Document property there is a method called Invoke or InvokeScript (something like that anyway), you can pass the function name and parameters of the JavaScript function to invoke through this. As for getting the results it's probably documented in the documentation about the InvokeScript function. (This may not be completely accurate but I do know that such a method does exists since I've used it but for reasons given in my sig I won't guarantee the accuracy :-D)
As of how to accomplish this I wouldn't have a clue at the moment and I'm too lazy to google it