C# 如何将 WebBrowser 从 IE 更改为 Firefox
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1949532/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to change WebBrowser from IE to Firefox
提问by Pankaj Mishra
I am working on a C# .NET application with System.Windows.Forms.WebBrowser.
我正在使用 System.Windows.Forms.WebBrowser 开发 C# .NET 应用程序。
IE is not responding properly, so i want to change to Mozilla Firefox.
IE 没有正确响应,所以我想改用 Mozilla Firefox。
How can I do this?
我怎样才能做到这一点?
采纳答案by SLaks
You can't.
你不能。
The WebBrowser
control is a wrapper around the IE ActiveX control, and cannot easily be swapped for Mozilla.
该WebBrowser
控件是 IE ActiveX 控件的包装器,不能轻易替换为 Mozilla。
However, you can look into the Mozilla ActiveX Control
但是,您可以查看Mozilla ActiveX 控件
回答by Benjamin Podszun
Not sure if that's possible/easy, but mono uses Gecko# to implement its version of System.Windows.Forms.WebBrowser. Maybe you can reuse that or rip some useable parts out of that code?
不确定这是否可能/容易,但 mono 使用 Gecko# 来实现其 System.Windows.Forms.WebBrowser 版本。也许您可以重用该代码或从该代码中删除一些可用的部分?
回答by jasonh
You'll want to replace the WebBrowser control with this project: http://code.google.com/p/geckofx/
您需要使用此项目替换 WebBrowser 控件:http: //code.google.com/p/geckofx/
回答by GrayWizardx
I was just looking at GeckoFXand WebKit.NETthey might be of interest to you. If you want to change the Default WebBrowser control I do not believe this is possible.
我只是在看GeckoFX和WebKit.NET,您可能会对它们感兴趣。如果您想更改默认 WebBrowser 控件,我认为这是不可能的。
回答by Matt Breckon
You cannot achieve this using the System.Windows.Forms.WebBrowser control. It seems there are ways to embed the Gecko rendering engine into a WinForms application.
您无法使用 System.Windows.Forms.WebBrowser 控件实现此目的。似乎有多种方法可以将 Gecko 渲染引擎嵌入到 WinForms 应用程序中。
see this question: Replacing .NET WebBrowser control with a better browser, like Chrome?
回答by serhio
System.Windows.Forms.WebBrowser
is just a managed wrapper for the ActiveX control: SHDocVw.WebBrowser
. The wrapper is not without bugs and may not provide the extensibility you need. If you have a working solution I don't suggest port it to use System.Windows.Forms.WebBrowser
.
System.Windows.Forms.WebBrowser
只是 ActiveX 控件的托管包装器:SHDocVw.WebBrowser
. 包装器并非没有错误,并且可能无法提供您需要的可扩展性。如果你有一个可行的解决方案,我不建议将它移植到使用System.Windows.Forms.WebBrowser
.
IE is not based on .Net so you can not use System.Windows.Forms.WebBrowser
to control anything in IE. In fact I don't even suggest wiring BHO in .Net because only one version of CLR can be running in the IE process and your BHO can be running on an unexpected version of CLR.
IE 不是基于 .Net 的,所以你不能用它System.Windows.Forms.WebBrowser
来控制 IE 中的任何东西。事实上,我什至不建议在 .Net 中连接 BHO,因为只有一个版本的 CLR 可以在 IE 进程中运行,而您的 BHO 可以在意外版本的 CLR 上运行。
回答by daniel.herken
Update 2016:
2016 年更新:
There are 3 additional options I can suggest that are still actively developed:
我可以建议另外 3 个选项仍在积极开发中:
A .Net component that can be used to integrate the Chrome engineinto your .Net Application. Based on CefGluebut a little faster on updates to the latest Chrome version. Also there is a commercial supportoption available which might come in handy for some. Of course the component itself is open source.
一个 .Net 组件,可用于将Chrome 引擎集成到您的 .Net 应用程序中。基于CefGlue,但在更新到最新的 Chrome 版本时速度要快一些。还有一个商业支持选项可能对某些人有用。当然,组件本身是开源的。
Another .Net component which can be used to integrate the Firefox engineinto your .Net application. This is based on Geckofxbut unlike the current version of Geckofx this will work with a normal release build of Firefox. To use Geckofx you will need to build Firefox yourself. Again commercial supportis available but the component itself is fully open source.
另一个 .Net 组件可用于将Firefox 引擎集成到您的 .Net 应用程序中。这是基于Geckofx 的,但与当前版本的 Geckofx 不同,这将适用于 Firefox 的正常发布版本。要使用 Geckofx,您需要自己构建 Firefox。再次提供商业支持,但组件本身是完全开源的。
Need all the different browsers in your .Net Application? Which the BrowseEmAll Core API you can integrate Chrome, Firefox, Webkit and Internet Explorerinto your application. This is a commercial productthough so be warned.
在您的 .Net 应用程序中需要所有不同的浏览器?您可以使用 BrowseEmAll Core API将 Chrome、Firefox、Webkit 和 Internet Explorer集成到您的应用程序中。这是一种商业产品,但请注意。
(Full disclosure: I work for this company so take everything I say with a grain of salt)
(完全披露:我在这家公司工作,所以对我所说的一切持保留态度)