'How to Override new tab when grid row is clicked using javascript

I Have a grid on first tab, when I click on first row , it opens new tab and first row details will be displayed , when I click on second row, already opened new tab should be overriden with second row details. How to do it using jQuery & JavaScript ?

Below is the code I am using currently and it is opening multiple new tabs instead of overriding.

window.open(_navUrl, '_blank','noreferrer',true);


Solution 1:[1]

window.open(_navUrl, '_blank','noreferrer',true);

Well, your noreferrer value should be a unique referer, for example "tab1", "tab2", "tab3", ...

Then you could refer to it when opening your new window.

Solution 2:[2]

The windowName parameter controls which window/tab is used.

https://developer.mozilla.org/en-US/docs/Web/API/Window/open

A DOMString specifying the name of the browsing context (window, or tab) into which to load the specified resource; if the name doesn't indicate an existing context, a new window is created and is given the name specified by windowName.

...

To open a new window on every call of window.open(), use the special value _blank for windowName.

So by using _blank each time, you are explicitly saying: open a new window. Instead, use the same name each time, eg

window.open(_navUrl, 'gridtab','noreferrer',true);

then it will reuse the same window/tab.

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 E-telier
Solution 2