Domanda

I need to open a new tab or popup window, and then any other time the original source link is clicked, it updates the already open tab or window. Right now it just keeps opening a new tab and that's not the behavior that's expected.

È stato utile?

Soluzione

Specify a custom target name:

<a href="something.html" target="otherpage">Go to some page #1</a>
<a href="something2.html" target="otherpage">Go to some page #2</a>

This will "name" the other window/tab and open links with the same target in that page, or in a new window/tab if one doesn't already exist. You can achieve the same effect with window.open by specifying the name as the second argument.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top