M.P.T.
M.P.T.

Reputation: 97

Opening a link to a new tab, and then opening another link onto that same tab that just opened

So I already know how to open a link into a new tab by using the target=_blank. My question is how do you open a second link onto that same tab instead of opening another new tab making three instead of two tabs?

Example:

<a href="allProducts.html" target=_blank>Products</a>

When clicked, should open a new tab.

<a href="allArtists.html" target=_blank>Artists</a>

When this is clicked, should open onto the previous new tab and not open another new tab.

So you should have the initial page, then click on allProducts to get that page on a new tab, and then click allArtists to open onto the allProducts tab to replace it instead of opening a third tab.

Upvotes: 2

Views: 914

Answers (1)

CertainPerformance
CertainPerformance

Reputation: 370979

You can give the <a>s a common target attribute, one other than _blank, for example:

<a href="allProducts.html" target="sidewindow">Products</a>
<a href="allArtists.html" target="sidewindow">Artists</a>

Cannot embed due to stack snippet sandboxing, but you can see it in action here:

https://jsfiddle.net/kbqp6dwa/

Upvotes: 2

Related Questions