Julian Coleman
Julian Coleman

Reputation: 13

Pick which browser window to open a new tab in

Typically when creating the markup for anchor tags in HTML, you can set a target attribute on the DOM node to specify how this link should open when clicked—in a new tab, in the current tab, etc.

Let's say, for example, I have two Chrome windows open. Window A is on my left on its own monitor, and window B is to my right, also on its own monitor. I have a custom new tab page that allows me quick access to links I visit the most frequently. It also has a big clock so I always know what time it is while I'm writing code. These links currently only open in a new tab in the same window.

Is it possible then to click a link in window A, and have it open as a new tab in window B so that I still have unobstructed access to my custom new tab page?

Upvotes: 1

Views: 59

Answers (1)

Quentin
Quentin

Reputation: 943649

No.

("Browser context" refers to a viewport with associated gubbins, typically a tab or window depending on the browser and OS).

You can:

  • Open in an existing, named, browser context
  • Open in a new, named or unnamed, browser content

The most control over where and what that context is, is to use JavaScript's open() method to specify the height and width, which will trigger a new window instead of a new tab in most desktop browsers.

There is no way to override the user preference to trigger a new tab instead of a new window. There is no way to determine where a new tab will appear.

Upvotes: 1

Related Questions