c# - 如何从 CefSharp 3 在 native 浏览器中打开链接

标签 c# .net wpf cefsharp

我需要在 CefSharp 3 的 native 浏览器中打开一个链接。我需要在 CefSharp 3 的 Chrome 浏览器中运行整个应用程序,除了一个表单。当我单击表单的链接按钮(例如 - 注册按钮。它有一个指向注册表单的链接)时,我需要在 native 浏览器(例如 - Internet Explorer)中打开此链接。

我们可以在 CefSharp 中实现吗?

我搜索了谷歌以及堆栈溢出。但无法找到解决方案。

最佳答案

按照 holroy 的建议,我在 CefSharp.Example 包的 RequestHandler 类中实现了 OnBeforeNavigation() 方法。

这是工作代码,

 bool IRequestHandler.OnBeforeBrowse(IWebBrowser browserControl,
 IBrowser browser, IFrame frame, IRequest request, bool isRedirect)
         {
             // If the url is Google open Default browser
             if (request.Url.Equals("http://google.com/"))
             {
                 // Open Google in Default browser 
                 System.Diagnostics.Process.Start("http://google.com/");
                 return true;
             }else
             {
                 // Url except Google open in CefSharp's Chromium browser
                 return false;
             }
         }

我希望这对以后的其他人有所帮助。

谢谢,

关于c# - 如何从 CefSharp 3 在 native 浏览器中打开链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31241240/

相关文章:

.NET RichTextBox 制表符

WPF 3D 模型绘图工具

wpf - 用于检查更新、安装新版本应用程序的代码

wpf - 管理用户可编辑的 WPF 样式

c# - 如何从 Silverlight DataContext 对象中检索数据

c# - RSA 加密 - 使用私钥加密

c# - Akka.net actor 大小

c# - 类型约束

javascript - 将文件对象从 Javascript 传递到 Web API

c# - 创建一个队列来处理由 FileSystemWatcher 触发的作业