Silverlight 4 OOB应用程序访问WebBrowser控件中页面的HTML DOM
有谁知道是否可以访问和操作由 Silverlight 4 WebBrowser 控件呈现的 html 页面中的元素。
场景是这样的。用户以更高的信任度启动 Silverlight OOB 应用程序。用户在应用程序中操作一些数据,但必须将部分数据提交到外部网站。如果我在 WebBrowser 控件中打开外部站点,是否可以通过对 DOM 的编程访问在外部站点的 Web 表单中预先填写一些信息来帮助用户?
Does anybody know if it is possible to access and manipulate an element in the html page that is rendered by the Silverlight 4 WebBrowser control.
The scenario is like this. The user launches a Silverlight OOB application with elevated trust. The user manipulates some data in the application but must submit part of the data to an external web site. If I open the external site in a WebBrowser control, is there any way I can assist the user by pre filling some information in the external sites' web form via programmatic access to the DOM?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
快速回答:否。
长答案:
OOTB + WebBrowserControl 的最初目的是帮助客户烘焙富文本格式显示(电子邮件、RSS 等),同时提供对大型文档(报告等)的打印支持的能力。
与此控件相同的规则适用于 iframe(据我所知,没有任何计划对此进行更改)。
你刚才提到的场景让我有点紧张,因为我看到 Silverlight 团队中的一些人提出了安全问题 - 因为这可以用作通过 Silverlight 对网站等进行自动 DOS 攻击的一种方法,因为毫无戒心有效负载(即使信任度提高,用户也经常被骗去安装这样的东西 - 这是现实,抱歉)..
-
Scott Barnes / 前 Silverlight 产品经理。
Quick answer: No.
Long Answer:
The original intent for the OOTB + WebBrowserControl was to help customers bake in both Rich Text Format displays (Email, RSS etc) and at the same time provide the ability for printing support for large documents to occur (reports etc).
The same rules apply for iframe as you have with this Control (as far as I know there isn't any plans to change this).
The scenario you just mentioned made me a little nervous as I can see a few of the guys on the Silverlight team raising the issue around security - in that this can be used as a way to automate DOS attacks on websites etc via Silverlight as the unsuspecting payload (even with elevated trust users are often duped into installing things like this - its the reality sorry)..
-
Scott Barnes / Former Silverlight Product Manager.
您可以使用 InvokeScript 方法在 WebBrowser 控件内执行 javascript 函数。请注意,您无法进行跨域调用。
示例:
Html 页面
Xaml
代码隐藏
You can execute javascript functions inside the WebBrowser control using the InvokeScript method. Note that you can't make cross-domain calls.
Example:
Html page
Xaml
code behind