'How to check if tab is already open when using target="_black"

I have the following snippet of my HTML code:

<div>
    <a href="https://www.google.com" target="_blank">Search Google</a>
</div>

But I want him to check first if the tab with the URL https://www.google.com is already open and if it is I want to access it. How will I do it?



Solution 1:[1]

You can use some unique framename as value of target attribute, which will open the link in same window if its already opened before:

<div>
 <a href="https://www.google.com" target="SomeUniqueName">Search Google</a>
</div>

'SomeUniqueName' is name of your tab/frame in this case.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rameez