In my code, after click on a link I'm open a pdf file in new tab, But after second click if that file is already open then instead of open in new tab I want to redirect to open tab of that file.
My code:
<span style="margin-left:10%;"><a href="image/Eng_Pamphlet.pdf" target="_blank">Broucher</a></span>'
As shown in above tab I'm set the target attribute "_blank", So it opens the link always in new tab. But I want after first time it redirect to first open tab only.
Some links are coded to open in the current tab while others open in a new tab. To take control of this behavior, press Ctrl when you click a link to stay on your current page while opening the link in a new tab in the background.
Method 1: Ctrl+Click Simply press and hold the Ctrl key (Cmd on a Mac) and then click the link in your browser. The link will open in a new tab in the background.
Opening the external links in new tabs allows users to scan the page once, click on all the relevant links and start consuming and sifting information. The user doesn't have to keep going back to the source page to continue scanning for more links to click.
The only time it is recommended that you open a link in a new tab is when opening in the same screen would interrupt a process (e.g. when a user is filling out a form or viewing a video). Linking in the same tab or screen in these situations could cause the user to lose the work they've done or have to start over.
Use target="_new"
instead. This will open the link in the same tab
Edit:
_new
is not really the best way to do this, as noted in the comment below by Chankey. You can just create a 'custom' value for the target
attribute that will allow the link to only open in a specific tab.
http://jsfiddle.net/GTr7L/ -> example
just assign a custom name to your target tab, so all the links will be 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 "_new" link will overwrite your pdf tab).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With