-1
<Link to="invoices" target="_blank">Invoices</Link> 

this opens a new tab. How do I do it for a new browser window ?

Drew Reese
  • 103,803
  • 12
  • 69
  • 96
mason
  • 43
  • 5
  • 1
    “Opening a new tab” is the same action as “opening a new window”. This is something controlled by the browser and configurable by the user in most browsers. – jsejcksn Jan 25 '22 at 14:50
  • You may be able to "right-click" the link and select "open in new window" from the context window. Otherwise, this is not configurable from within a RRD `Link`. – Drew Reese Jan 25 '22 at 16:29

2 Answers2

0

You can do window.open in a onClick, here's the documentation https://developer.mozilla.org/en-US/docs/Web/API/Window/open

  • window.open doesn't help, it just opens up a pop-up window, I need an exact new window (which we get when we "Right Click" on chrome and select "New Window" ). – mason Jan 26 '22 at 17:27
0

As a hack (and I mean that genuinely), you can accomplish this in browsers which support the shift + click gesture to open a new window by using this for the onClick function of the anchor element:

(event) => {
  event.preventDefault();
  event.target.dispatchEvent(new MouseEvent('click', {shiftKey: true}));
};

I tested it against Chrome desktop only.

jsejcksn
  • 13,536
  • 3
  • 21
  • 44