This ilifehandler code doesnt work

Having problems with building or using the CefSharp .NET binding? Ask your CEF-related questions here. Please ask general usage questions on StackOverflow.

Moderator: amaitland

This ilifehandler code doesnt work

Postby imcool » Fri Feb 12, 2021 8:54 am

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;

Posts: 1
Joined: Fri Feb 12, 2021 12:29 am

Return to CefSharp Forum

Who is online

Users browsing this forum: No registered users and 1 guest