I have created two hyperlink in which when I click the hyperlink, it should open a new tab in the browser with the corresponding link webpage content, I have done that by using window.open
feature,Its working fine, But the problem is that say when I click the hyperlink for the very first time it will open up a new tab, Again when I click the same or the second hyperlink it is opening another tab within the browser, instead If the current opened tab is still opened I need it be reloaded with that tab itself, If none of the tabs were opened then it should open a fresh new tab.
Is this can be done through JavaScript
My Code is as given below
html
<a href="javascript:void(0);" onclick="openTab('http://stackoverflow.com')">StackOverflow</a>
<a href="javascript:void(0);" onclick="openTab('https://github.com')">GitHub</a>
script
function openTab(link) {
window.mypopup = window.open(link);
}