Feature #967


Disable automatic opening of links in a new tab

Added by Soren Stoutner about 1 year ago. Updated 9 months ago.

In Progress
Start date:
Due date:
% Done:


Estimated time:


This would mirror the behavior of Privacy Browser Android, where a user must choose to open a link in a new tab.

It also fixes a bug where, at least sometimes, links automatically opened in new tabs do not load domain settings. For an example of this, clink on a tracking link in Order History at


remove-target-blank.patch (1.01 KB) remove-target-blank.patch Soren Stoutner, 05/22/2023 06:47 AM
Actions #1

Updated by Soren Stoutner 11 months ago

It turns out this is a whole lot more difficult than I expected.

Actions #2

Updated by Soren Stoutner 10 months ago

3rdparty/chromium/third_party/blink/renderer/core/loader/ is getting close to the right place.

Actions #3

Updated by Soren Stoutner 10 months ago

src/3rdparty/chromium/chrome/browser/ui/webui/history/ contains this example that only applies to navigating the history:

WindowOpenDisposition disposition = ui::DispositionFromClick(
      middle_button, alt_key, ctrl_key, meta_key, shift_key,
      (target_string == "_blank") ? WindowOpenDisposition::NEW_FOREGROUND_TAB
                                  : WindowOpenDisposition::CURRENT_TAB);

It indicates that we are looking for something that calls ui::DispositionFromClick() with the sixth argument set to WindowOpenDisposition::NEW_FOREGROUND_TAB.

Actions #4

Updated by Soren Stoutner 10 months ago

This is defined at src/3rdparty/chromium/ui/base/window_open_disposition.h

WindowOpenDisposition DispositionFromClick(
    bool middle_button,
    bool alt_key,
    bool ctrl_key,
    bool meta_key,
    bool shift_key,
    WindowOpenDisposition disposition_for_current_tab =

Meaning that, if nothing is specified, the current tab is used by default. So some place this is being set to WindowOpenDisposition::NEW_FOREGROUND_TAB for _blank.

Actions #5

Updated by Soren Stoutner 10 months ago

  • Description updated (diff)
Actions #6

Updated by Soren Stoutner 10 months ago

It feels like it ought to be somewhere close to 3rdparty/chromium/content/renderer/ or 3rdparty/chromium/content/renderer/

Actions #7

Updated by Soren Stoutner 10 months ago

Actions #8

Updated by Soren Stoutner 9 months ago

The attached patch implements this feature. However, this is not something that would be accepted upstream. It looks like I am going to have to release PrivacyWebEngine sooner than I had originally anticipated.


Also available in: Atom PDF