我需要在 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/