WebBrowser控件的的window.external总是空 [英] Webbrowser control's window.external is ALWAYS null

查看:1351
本文介绍了WebBrowser控件的的window.external总是空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Web浏览器的window.external对象总是空!

The Web browser's Window.External object is always null!

要重现上了一个新的WinForm和拖放式网页浏览器:

To reproduce drop a web browser on a new winform and type:

Option Strict Off

Public Class Form1
    Private Sub Form1_Load()
        Handles MyBase.LoadMe.WebBrowser1.Document.Window.DomWindow.External.AddFavorite("http://www.google.com")
    End Sub
End Class

请确定您去大会信息对​​话框,选中使大会COM可见。这是必要的。

Make certain you go to the Assembly Information dialog and check "Make Assembly COM-Visible." This is necessary.

我迷路了,为什么一个COM可见装配外部对象总是一无所获。

I am lost as to why with a COM visible assembly the External object is always nothing.

推荐答案

你有没有设置<一个href=\"http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.objectforscripting.aspx\">ObjectForScripting属性为您的主机的窗口?我认为你需要做的,对的window.external工作。

Have you set the ObjectForScripting property to your host window? I think you need to do that for window.external to work.

这篇关于WebBrowser控件的的window.external总是空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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