In Javascript, we can use window.open() to open a new browser window or tab. But if a tab is already open, it should highlight that only. It should not open duplicate tabs. How to do that?
The second argument of window.open(strUrl, strWindowName[, strWindowFeatures]);
is the window name. if you specify that parameter, to anything other than "_blank" it will refer to the already opened tab/window.
For instance:
window.open('/about', 'newwindow');
and
window.open('/contact', 'newwindow');
will open the page in an already opened window/tab.