How to limit the connection to open only once in a new tab?

In my code, after clicking on the link, I open the pdf file in a new tab, but after the second click, if this file is already open, instead of opening it in a new tab, I want to redirect this file to an open tab.

My code is:

<span style="margin-left:10%;"><a href="image/Eng_Pamphlet.pdf" target="_blank">Broucher</a></span>' 

As the tab above shows, I set the target attribute "_blank", so it always opens the link in a new tab. But I want the first time it is redirected only to the first open tab.

+7
html
source share
2 answers

Use target="_new" instead. This will open the link in the same tab.

Edit:

_new is actually not the best way to do this, as noted in the comment below by Chankey. You can simply create a "custom" value for the target attribute, which allows you to open the link only on a specific tab.

http://jsfiddle.net/GTr7L/ → example

+5
source share

just assign a custom name to your target tab so that all links are redirected to your custom tab

 <span style="margin-left:10%;"><a href="image/Eng_Pamphlet.pdf" target="myPDFTabAndEveryTimeThisOne">Broucher</a></span>' 

(if you use "_new", another standard link "_new" will overwrite your pdf tab).

+4
source share

All Articles