Page 1 of 1

This ilifehandler code doesnt work

PostPosted: Fri Feb 12, 2021 8:54 am
by imcool
hi all,
I am trying to disallow disable open page in new window, see in screenshot there are 2 windows opened but I want it to open only in one Window and not in two different window

I tried code from following resources but nothing works for me, can someone please help me with a solution?

I tried following but no luck, maybe i did something wrong as I am not good at coding :( ... Handler-an

Code: Select all
using CefSharp;
using CefSharp.WinForms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
using System.Runtime.InteropServices;
using System.Diagnostics;
using Microsoft.Win32;

namespace Nysus

public partial class Form1 : Form
        public Form1()

        ChromiumWebBrowser chrome;
        private void Form1_Load(object sender, EventArgs e)
            CefSettings settings = new CefSettings();
            chrome = new ChromiumWebBrowser("");
            chrome.Dock = DockStyle.Fill;
            this.FormBorderStyle = FormBorderStyle.None;
            this.WindowState = FormWindowState.Maximized;
            if (chrome.CanGoForward)
            if (chrome.CanGoBack)
        private void Form1_FormClosing_1(object sender, FormClosingEventArgs e)

        public bool OnBeforePopup(IWebBrowser chromiumWebBrowser, 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;
            return true;