使用CefSharp跳转页面不弹出页面:

using CefSharp;
using CefSharp.Wpf;
namespace Common.Control
{
    internal class CefSharpOpenPageSelf : ILifeSpanHandler
    {
        public bool DoClose(IWebBrowser browserControl, IBrowser browser)
        {
            return false;
        }
        public void OnAfterCreated(IWebBrowser browserControl, IBrowser browser)
        {
        }
        public void OnBeforeClose(IWebBrowser browserControl, IBrowser browser)
        {
        }
        public bool OnBeforePopup(IWebBrowser browserControl, IBrowser browser,  IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition  targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo  windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out  IWebBrowser newBrowser)
        {
            newBrowser = null;
            var chromiumWebBrowser = (ChromiumWebBrowser)browserControl;
            chromiumWebBrowser.Load(targetUrl);
            return true; //Return true to cancel the popup creation copyright by  codebye.com.
        }
    }
}

 

转载于:https://www.cnblogs.com/TimLiuDream/p/9897932.html

  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

表情包
插入表情
评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符
相关推荐
©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页