Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8954585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:20:30+00:00 2026-06-15T14:20:30+00:00

Now I have a link <a href=blabla target=_blank>link</a> However, this always open up a

  • 0

Now I have a link

<a href="blabla" target="_blank">link</a>

However, this always open up a new tab. I want the following effect

  1. If the user already has a tab with the same URL, reuse that tab, and refresh if possible
  2. Otherwise, open a new tab

How can I achieve this using JavaScript?

It’s OK if there’re only some browser-specific methods, so users of browsers without corresponding support will “fallback” to the always-new-tab way.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:20:31+00:00Added an answer on June 15, 2026 at 2:20 pm

    You can set specific window’s name, in order to open reuse the tab. The problem is, as far as the href will be the same, it won’t be reloaded. So you can’t obtain the refresh part easily.

    So, for instance, you can have:

    <a href="blabla" target="blabla">link</a>
    <a href="foo" target="bar">link</a>
    

    In JS, you can actually obtain the same, using window.open. You could also use the url as target, so that you don’t need to specify manually:

    <a href="blabla" onclick="window.open(this.href, this.href); return false">link</a>
    <a href="foo" onclick="window.open(this.href, this.href); return false">link</a>
    

    You could also generalize, and add a click listener to the document, in order to open some links in this way. Something like:

    <div id="container">
        <a href="blabla">link</a>
        <a href="foo">link</a>
    </div>
    
    <script>
        document.getElementById("container").onclick = function(evt){
            if (evt.target.tagName === "A")
                window.open(evt.target.href, evt.target.href);
    
            return false;
        }
    </script>
    

    If the page are on the same domain, at this point you could probably trying to do an empiric refresh of the page as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

lets say we have a link <a href=/something target=_new>blah</a> and now i want a
I have a link inside a div: <div class=embed> <a href=http://google.com/></a> </div>​ So now
i have a link <a id=cartLink href=https://site.foxycart.com/cart?cart=checkout >Test</a> when you click on this link
Right now I have a link that causes a hidden div to appear when
Right now I have a foreach loop that grabs the first link with an
I have some code right now that executes when a link is clicked. The
Mobile devices have started to do link detection fairly well. They now detect links,
I have a table with lots of generic link from a DB. Now the
I now have a file uploader that goes on like this This is the
I have a link as follows. @Html.ActionLink(Create Report, Screenreport, Reports, null, new { @class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.