繁体   English   中英

在 webBrowser c# 控件代替 IE 控件打开网页的问题

[英]problem of opening a webPage in webBrowser c# control in place of IE control

For my project I used webBrowser control and when I launch an html site which has got an input(type) button with onclick javascript function which process ending on window.open target="_blank", it's internet explorer window that's is opening in place of webBrowser 的新页面。

我使用winform技术在c#代码中编程,我使用了webBrowser System.Windows.Forms。

因此,我可以使用哪个 function 在 webBrowser window 代替 IE window 中打开此站点的页面。

谢谢你的帮助。

阅读有关WebBrowser.Navigating事件的信息:

如果某些条件未满足,例如,当用户未完全填写表单时,您可以处理 Navigating 事件以取消导航。 要取消导航,请将传递给事件处理程序的 WebBrowserNavigatingEventArgs object 的 Cancel 属性设置为 true。 您还可以使用此 object 通过 WebBrowserNavigatingEventArgs.Url 属性检索新文档的 URL。

在默认浏览器中打开页面,例如:

private void webBrowser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
{
    e.Cancel = true;
    Process.Start(e.Url.ToString());
}

最后,

I used the package reference "SHDocVm" of "Microsoft Internet Controls" and I place a function handler NewWindow3 in the function "DocumentCompleted" of webBrowser and it's ok, a window.open() javascript function with target="_blank" opens a new网页浏览器的页面。

肃然。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM