Skip to content

Chromium Browser opens up #5067

Closed
Closed

Description

@RawHut

Is there an existing issue for this?

  • I have searched both open/closed issues, no issue already exists.

CefSharp Version

133.0.6943.127 (Official Build) (64-bit)

Operating System

Windows 11

Architecture

x64

.Net Version

Net4.7.2

Implementation

WinForms

Reproduction Steps

Reproducible Steps:

Visit the Chrome Web Store online.
Click the "Add to Chrome" button.
A standard Chrome-style dialog box appears, asking for confirmation to add the extension.
Once confirmed, a new process (Chromium) starts with its light blue logo.
A complete browser session launches with the new extension installed.

Expected behavior

Expected Behavior:
The extension should load using a designated directory located in the user's local application data folder. The application combines the local application data path with the "Hyper X/Extensions" folder and adds this path to the command-line arguments with the "load-extension" option. However, after the extension is added, it appears that the CRX file is being deleted.

string extensionsDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Hyper X", "Extensions"); settings.CefCommandLineArgs.Add("load-extension", extensionsDir);

Actual behavior

Image

Actual Behavior:
After clicking the "Add to Chrome" button and confirming the installation, a new Chromium-based browser process launches with a light blue logo. This is unexpected, as the extension should load within the current process rather than starting a new instance of Chromium. Additionally, the CRX file is deleted, which prevents the extension from functioning as intended. Extra pice of info : I am auto downloading file via downloadhandler because it rediretcs to download the extension file when clicked on add extension

Regression?

No response

Known Workarounds

No response

Does this problem also occur in the CEF Sample Application

Yes using WPF/OffScreen command line args

Other information

No response

Activity

  1. added
    upstreamThese issues require fixing in the Chromium Embedded Framework(CEF) or Chromium.
    on Mar 13, 2025
  2. RawHut commented on Mar 13, 2025

    @RawHut
    Author

    Small update: I've managed to load extensions, though with some limitations. Extensions that require GUI modifications or setting changes aren't fully compatible with CEF, but those that don't require interaction load successfully. The process involves downloading the extension's .crx file, modifying its binary data to convert it into a .zip archive, and then using the command-line argument mentioned earlier to load the extracted extension.

  3. RawHut commented on Mar 14, 2025

    @RawHut
    Author

    Is there an existing issue for this?

    • I have searched both open/closed issues, no issue already exists.

    CefSharp Version

    133.0.6943.127 (Official Build) (64-bit)

    Operating System

    Windows 11

    Architecture

    x64

    .Net Version

    Net4.7.2

    Implementation

    WinForms

    Reproduction Steps

    Reproducible Steps:

    Visit the Chrome Web Store online.
    Click the "Add to Chrome" button.
    A standard Chrome-style dialog box appears, asking for confirmation to add the extension.
    Once confirmed, a new process (Chromium) starts with its light blue logo.
    A complete browser session launches with the new extension installed.

    Expected behavior

    Expected Behavior:
    The extension should load using a designated directory located in the user's local application data folder. The application combines the local application data path with the "Hyper X/Extensions" folder and adds this path to the command-line arguments with the "load-extension" option. However, after the extension is added, it appears that the CRX file is being deleted.

    string extensionsDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Hyper X", "Extensions"); settings.CefCommandLineArgs.Add("load-extension", extensionsDir);

    Actual behavior

    Image

    Actual Behavior:
    After clicking the "Add to Chrome" button and confirming the installation, a new Chromium-based browser process launches with a light blue logo. This is unexpected, as the extension should load within the current process rather than starting a new instance of Chromium. Additionally, the CRX file is deleted, which prevents the extension from functioning as intended. Extra pice of info : I am auto downloading file via downloadhandler because it rediretcs to download the extension file when clicked on add extension

    Regression?

    No response

    Known Workarounds

    No response

    Does this problem also occur in the CEF Sample Application

    Yes using WPF/OffScreen command line args

    Other information

    No response


    I've recently managed to load extensions in CEF, albeit with some limitations. Extensions that depend on GUI modifications or dynamic setting changes aren’t fully supported, but non-interactive extensions load successfully. The process involves:

    1. Downloading the .crx File:
      Obtain the extension's .crx file.

    2. Conversion to .zip:
      Modify its binary content (in memory) to convert it into a .zip archive, then extract the archive.

    3. Loading via Command-Line:
      Use the --load-extension command-line argument to point CEF to the extracted extension directory.

    Below is a sample Program.cs that demonstrates how to load an extracted extensions:

    using CefSharp;
    using CefSharp.WinForms;
    using System;
    using System.IO;
    using System.Windows.Forms;
    
    namespace CefExtensionLoader
    {
        static class Program
        {
            [STAThread]
            static void Main()
            {
                // Initialize CefSharp settings with extension support
                var settings = new CefSettings();
                
                // Set the path to your extracted extension directory
                string extensionPath = @"C:\Path\To\Extracted\Extension";
                settings.CefCommandLineArgs.Add("load-extension", extensionPath);
    
                Cef.Initialize(settings);
    
                // Launch a browser instance
                var browser = new ChromiumWebBrowser("https://www.example.com");
                var form = new Form { Width = 1024, Height = 768 };
                form.Controls.Add(browser);
                Application.Run(form);
            }
        }
    
    

    Note:

    Extensions that require user interaction (GUI modifications or dynamic settings) may not function as expected.

    This method only supports non-interactive extensions.

    The conversion from .crx to .zip is necessary to extract the extension contents, which are then loaded via the command-line argument.

    I'm looking forward to feedback and any suggestions for further improvements.

  4. locked and limited conversation to collaborators on Mar 17, 2025
  5. converted this issue into a discussion #5069 on Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    upstreamThese issues require fixing in the Chromium Embedded Framework(CEF) or Chromium.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions