How to open a link in the same new named tab, every time

Public, Tricks, Other Languages

harrylevine

Created: Nov 14, 2017     Updated: Nov 14, 2017


When you want a link to open up in a new tab, you simply set the target to _blank:

<a href="http://www.starfall.com/" target="_blank">Starfall</a>

But what if you have an index view containing all your Posts, and you want a link to each post's show view to all open up in a new tab, but the same tab.

Meaning if you click on five posts from the index view, you should only have a total of two tabs open. One for the index view, and one for the show view.

To do this, you simply change the target to any arbitrary named string:

<a href="http://www.starfall.com/" target="starfall-view">Starfall</a>

https://stackoverflow.com/a/2343944/3899985