Click Link (ex: onclick="javascript:window.open().location.href='URL')
Open New Window(or New tab)
First time only open new window(tab) but Second time refresh same window.(Don't open another window)
How can this be possible?
(Problem solved)
function newWindow(url,target)
{
if(localStorage.getItem(target))
{
window.open(url,target);
}else
{
localStorage.setItem(target,true);
window.open(url,target);
}
}
You could use localStorage
to solve this problem:
localStorage.setItem("secondWindow", true)
Then create a function for onclick
that checks if the value exist by doing localStorage.getItem("secondWindow");