admin管理员组

文章数量:1425176

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

Example:Main.html

<a href ="/" target="_blank">Google</a><br>
<a href ="/" 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.

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./" 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.

Share Improve this question edited Mar 2, 2019 at 20:08 Sacha 89310 silver badges29 bronze badges asked Mar 2, 2019 at 19:07 Pritiranjan SwainPritiranjan Swain 911 silver badge7 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 10

Set your target attribute.

<a href="https://www.facebook." 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.

本文标签: javascripthref target tab should open a tab in first and update on second timeStack Overflow