Skip to content

[declarativeNetRequest] Ability to redirect web link navigations to a new tab/window #908

@tophf

Description

@tophf

This is useful for extensions that handle a certain MIME type via Content-Type response header (a userscript/userstyle manager, PDF, media viewer) and show their UI for the resource in a new tab or window, particularly in a simple popup window without distractions like tabs, address bar, toolbars or menus.

With webRequestBlocking it's easy: we cancel the navigation in the original tab and open a new tab/window passing the URL along.

Possible solutions for MV3 (all must require a host permission because a URL is exposed):

  1. Add chrome.webRequest.onBlockedDeclaratively event with ruleIds: [1,2,3] property added to the standard webRequest filter parameter.
  2. Add "blockAndNotify" or "blockAndNotifyWebRequest" to the action's type string.
  3. Add notifyWebRequest boolean to the rule dictionary, but it's weird because it only makes sense when blocking.
  4. Add openIn or retarget or newTarget property in the "redirect" dictionary with values like "tab", "window" however it will also require chrome.declarativeNetRequest.setWindowOptions(opts) so extensions can set the position and size of the window like {type: 'popup', left: 123, top: 100, width: 500, height: 300} to avoid having a non-customizable fugly huge popup like the one opened by chrome.identity API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triage: chromeChrome needs to assess this issue for the first timeneeds-triage: firefoxFirefox needs to assess this issue for the first timeneeds-triage: safariSafari needs to assess this issue for the first timetopic: dnrRelated to declarativeNetRequest

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions