Project

General

Profile

Actions

Feature #967

open

Disable automatic opening of links in a new tab

Added by Soren Stoutner over 1 year ago. Updated over 1 year ago.

Status:
In Progress
Priority:
1.x
Start date:
02/28/2023
Due date:
% Done:

0%

Estimated time:

Description

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 neweggbusiness.com.


Files

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 over 1 year ago

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

https://forum.qt.io/topic/93524/qwebengine-open-links-issue/12

Actions #2

Updated by Soren Stoutner over 1 year ago

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

Actions #3

Updated by Soren Stoutner over 1 year ago

src/3rdparty/chromium/chrome/browser/ui/webui/history/navigation_handler.cc 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 over 1 year 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 =
        WindowOpenDisposition::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 over 1 year ago

  • Description updated (diff)
Actions #6

Updated by Soren Stoutner over 1 year ago

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

Actions #7

Updated by Soren Stoutner over 1 year ago

3rdparty/chromium/third_party/blink/public/web/web_navigation_params.h
Actions #8

Updated by Soren Stoutner over 1 year 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.

Actions

Also available in: Atom PDF