Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8009293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:24:13+00:00 2026-06-04T18:24:13+00:00

Is it possible to disable view source option in Delphi Chromium Embedded ? I

  • 0

Is it possible to disable view source option in Delphi Chromium Embedded ?
I haven’t found anything suitable in properties/methods list.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T18:24:14+00:00Added an answer on June 4, 2026 at 6:24 pm

    There are no direct settings or events allowing to hide Chromium popup menu items. However you have at least few options how to continue, you can for instance:

    1. Tell user that the View source option is forbidden and decline the action

    You can decide what action will you allow or decline in the OnMenuAction event handler, where if you assign True to the Result parameter the action is declined. The following code checks that you have performed the view source action and if so, decline the action and show the information message:

    type
      TCefMenuId = TCefHandlerMenuId;
    
    procedure TForm1.Chromium1MenuAction(Sender: TObject;
      const browser: ICefBrowser; menuId: TCefMenuId; out Result: Boolean);
    begin
      if menuId = MENU_ID_VIEWSOURCE then
      begin
        Result := True;
        ShowMessage('View page source is not allowed!');
      end;
    end;
    

    2. Fake the menu item to something custom by changing menu item’s caption with its action

    You can take advantage of the menu item for something else by changing the menu item’s caption and executing some custom action. The following sample code shows how to change the view source menu item into the about box menu item:

    type
      TCefMenuId = TCefHandlerMenuId;
    
    procedure TForm1.Chromium1GetMenuLabel(Sender: TObject;
      const browser: ICefBrowser; menuId: TCefMenuId; var caption: ustring;
      out Result: Boolean);
    begin
      if menuId = MENU_ID_VIEWSOURCE then
        caption := 'About my application...';
    end;
    
    procedure TForm1.Chromium1MenuAction(Sender: TObject;
      const browser: ICefBrowser; menuId: TCefMenuId; out Result: Boolean);
    begin
      if menuId = MENU_ID_VIEWSOURCE then
      begin
        Result := True;
        ShowMessage('About box...!');
      end;
    end;
    

    3. Create you own custom page (frame) popup menu

    You can create your own popup menu, but you need to consider that this menu is quite hardcoded, so you will need to maintain it if you’ll need to have it the same with each new version of Delphi Chromium wrapper. Here is the code how to create the page menu without view source menu item:

    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, Menus, cefvcl, ceflib;
    
    type
      PCefMenuInfo = PCefHandlerMenuInfo;
    
    type
      TForm1 = class(TForm)
        Chromium1: TChromium;
        procedure FormCreate(Sender: TObject);
        procedure Chromium1BeforeMenu(Sender: TObject; const browser: ICefBrowser;
          const menuInfo: PCefMenuInfo; out Result: Boolean);
      private
        PageMenu: TPopupMenu;
        procedure OnNavigateBackMenuItemClick(Sender: TObject);
        procedure OnNavigateForwardMenuItemClick(Sender: TObject);
        procedure OnPrintMenuItemClick(Sender: TObject);
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    procedure TForm1.OnNavigateBackMenuItemClick(Sender: TObject);
    begin
      Chromium1.Browser.GoBack;
    end;
    
    procedure TForm1.OnNavigateForwardMenuItemClick(Sender: TObject);
    begin
      Chromium1.Browser.GoForward;
    end;
    
    procedure TForm1.OnPrintMenuItemClick(Sender: TObject);
    begin
      Chromium1.Browser.GetFocusedFrame.Print;
    end;
    
    procedure TForm1.Chromium1BeforeMenu(Sender: TObject;
      const browser: ICefBrowser; const menuInfo: PCefMenuInfo;
      out Result: Boolean);
    begin
      if menuInfo.typeFlags = MENUTYPE_PAGE then
      begin
        Result := True;
        PageMenu.Items[0].Enabled := browser.CanGoBack;
        PageMenu.Items[1].Enabled := browser.CanGoForward;
        PageMenu.Popup(menuInfo^.x, menuInfo^.y);
      end;
    end;
    
    procedure TForm1.FormCreate(Sender: TObject);
    var
      MenuItem: TMenuItem;
    begin
      PageMenu := TPopupMenu.Create(Self);
      MenuItem := TMenuItem.Create(PageMenu);
      MenuItem.Caption := 'Back';
      MenuItem.OnClick := OnNavigateBackMenuItemClick;
      PageMenu.Items.Add(MenuItem);
      MenuItem := TMenuItem.Create(PageMenu);
      MenuItem.Caption := 'Forward';
      MenuItem.OnClick := OnNavigateForwardMenuItemClick;
      PageMenu.Items.Add(MenuItem);
      MenuItem := TMenuItem.Create(PageMenu);
      MenuItem.Caption := '-';
      PageMenu.Items.Add(MenuItem);
      MenuItem := TMenuItem.Create(PageMenu);
      MenuItem.Caption := 'Print';
      MenuItem.OnClick := OnPrintMenuItemClick;
      PageMenu.Items.Add(MenuItem);
      Chromium1.Load('www.stackoverflow.com');
    end;
    
    end.
    

    Footnote

    The type definitions used in all code samples are there because I’ve noticed that some version of Delphi Chromium has wrong event handler definitions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicates: How to disable (View Source) and (Ctrl + C ) from my
Possible Duplicate: Disable copying data from webpage Most content in a webpage could be
Is it possible to disable full keyboard and mouse when I run my c
Is it possible to disable all authentication in a subfolder of a web site
Is it possible to disable individual options in a Zend_Form_Element_Radio ? That is, I'd
Is it possible to disable texture colors, and use only white as the color?
Is it possible to disable Expose programmatically?
Is it possible to disable all the I/O ports of the Windows PC my
Is it possible to disable the volume in sound settings? I have googled but
Is it possible to disable command history within a batch file? After calling a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.