Reputation: 91
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
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