Pritiranjan Swain
Pritiranjan Swain

Reputation: 91

href target tab should open a tab in first and update on second time

I am quite new to HTML, I have senior where I have two anchor tags in one HTML page.

Example:Main.html

<a href ="https://www.google.co.in/" target="_blank">Google</a><br>
<a href ="https://www.facebook.com/" target="_blank">facebook</a>

My goal is to open Facebook or Google in a new tab when the user first clicks a link.

When the user clicks a link again, it shouldn't open a new tab, but instead it should update the Google or Facebook tab that has already been opened.

Upvotes: 3

Views: 1476

Answers (1)

Brad
Brad

Reputation: 163240

Set your target attribute.

<a href="https://www.facebook.com" target="facebookTargetTab" />Facebook</a>

Links with the same target will open up in the same new tab. This behavior is a holdover from the days of framesets, where each frame was named. If the name didn't exist, a new window (and these days, a new tab) was opened.

Upvotes: 10

Related Questions