webBrowser控件如何获取弹出页面!webBrowser1.Document.InvokeScript("Show"); //调用JS的Show方法js代码
function Show()
{
window.open("1.html");
}
这样 当我 执行 webBrowser1.Document.InvokeScript("Show"); 的 时候会弹出 一个用IE打开的1.html 这个 页面但是 现在 我想 获取 这个页面让这个页面 也显示在 另外一个 webBrowser控件中这个 该 如何 实现
我要用C# 实现 不要VB的
function Show()
{
window.open("1.html");
}
这样 当我 执行 webBrowser1.Document.InvokeScript("Show"); 的 时候会弹出 一个用IE打开的1.html 这个 页面但是 现在 我想 获取 这个页面让这个页面 也显示在 另外一个 webBrowser控件中这个 该 如何 实现
我要用C# 实现 不要VB的
如果你用Windows表单类库的Webrowser类的话,需要访问ActiveXInstance
private SHDocVw.WebBrowser_V1 Web_V1;
private void Form_Load(object sender, EventArgs e)
{//Setup Web_V1 interface and register event handlerthis.webBrowser1.Navigate(url); Web_V1= (SHDocVw.WebBrowser_V1)this.webBrowser1.ActiveXInstance; Web_V1.NewWindow+=new SHDocVw.DWebBrowserEvents_NewWindowEventHandler(Web_V1_NewWindow); }
private void Web_V1_NewWindow(string URL,int Flags,string TargetFrameName,refobject PostData,string Headers,refbool Processed)
{ Processed=true;//Stop event from being processed//Code to open in same window//this.webBrowser1.Navigate(URL);//Code to open in new window instead of same window
Fomr1 Popup=new Form1(URL); Popup.Show(); }