Feature #967
closed
  
    
    
  
Disable automatic opening of links in a new tab
 
        
        Added by Soren Stoutner over 2 years ago.
        Updated 9 months ago.
        
  
  
  
  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
  
 
  
  
  
  
    
    
    
    3rdparty/chromium/third_party/blink/renderer/core/loader/navigation_policy.cc is getting close to the right place.
 
   
  
  
    
    
    
    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.
 
   
  
  
    
    
    
    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.
 
   
  
  
    
    
    
    
       - Description updated (diff)
 
   
  
  
    
    
    
    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.
 
   
  
  
    
    
    
    3rdparty/chromium/third_party/blink/public/web/web_navigation_params.h
     
   
  
  
    
    
    
    
    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.
 
   
  
  
    
    
    
    
       - Status changed from In Progress to Closed
- Priority changed from 1.x to Next Release
 
   
  
 
  
  
 
Also available in:  Atom
  PDF