阅读从Web浏览器的Javascript的控制变量 [英] Read Javascript variable from Web Browser control

查看:99
本文介绍了阅读从Web浏览器的Javascript的控制变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想读里面装的从我的窗体上的WebBrowser控件称为一个Javascript变量的值。

I am trying to read the value of a Javascript variable which is loaded and called from a WebBrowser control on my form.

例如:

index.html的指的是一个名为'test.js的javascript
在test.js,创建几个变量和填充。

index.html refers to a javascript called 'test.js' On test.js, several variables are created and populated.

index.html的话让调用这个JS。

index.html then makes a call to this JS.

的index.html加载并显示到WebBrowser控件。

Index.html is loaded and displayed into the WebBrowser control.

我发现很多的帮助就如何调用/调用驻留在Web浏览器中的控制功能。如何我怎么能轻松读取一个变量的值?

I've found lots of help on how to call/invoke functions that reside in the web browser control. How how can I easily read a variable value?

推荐答案

您可以这样做:

Document.InvokeScript("eval", new object[] { "my_var_name" });

这篇关于阅读从Web浏览器的Javascript的控制变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆