Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blank links opens in the same window - Why, and how to fix it? [closed]

I have four links:

<a href="http://google.com" target="_blank">Google</a>
<a href="http://bing.com" target="_blank">Bing</a>
<a href="http://yahoo.com" target="_blank">Yahoo</a>
<a href="http://wikipedia.com" target="_blank">wiki</a>

When I click on a link, it will opens in a new window. And on click to another link, it will opens in the same window opened last time.

It is not good for me, I want to open a blank window on every single click, regardless of the opened windows.

How can I handle this? (I don't care about double-click Google link opens it twice, doesn't matter.)

And this is works, just it have to.

EXCUSE ME, communication problem with my PHP beast.

So, actually the links are like:

<a href="javascript:;" onclick = "window.open('http://google.com','Admin');">gaagle</a>
<a href="javascript:;" onclick = "window.open('http://bing.com','Admin');">bang</a>
<a href="javascript:;" onclick = "window.open('http://yahoo.com','Admin');">yahuu!</a>

And now, all the stuffs opens to the same window, because of the name tag (2nd param of window.open) -.- And since all the opened window's ID was Admin, every other windows opened on that window. I did not checked it, excuse me for wasting your time.

like image 870
Répás Avatar asked Oct 31 '11 11:10

Répás


Video Answer


1 Answers

If you give each link a different target, they will open in different tabs / windows.

<a href="http://google.com" target="googleWindow">Google</a>
<a href="http://bing.com" target="bingWindow">Bing</a>
<a href="http://yahoo.com" target="yahooWindow">Yahoo</a>
<a href="http://wikipedia.com" target="wikiWindow">wiki</a>

If you click a second time on a link, it will re-use the existing window if it is still available.

If you use target="_blank" every click should be in a new tab / window, regardless of previous clicks. If you aren't getting this behaviour, what browser are you using?

If you want all clicks to goto the same window use...

<a href="http://google.com" target="myWindow">Google</a>
<a href="http://bing.com" target="myWindow">Bing</a>
<a href="http://yahoo.com" target="myWindow">Yahoo</a>
<a href="http://wikipedia.com" target="myWindow">wiki</a>
like image 118
Fenton Avatar answered Sep 27 '22 20:09

Fenton