Skip to main content
Known Participant
October 30, 2017
Answered

Opening a link in a new tab

  • October 30, 2017
  • 2 replies
  • 4014 views

Is there specific syntax that would allow me to force viewer to open a particular link in a new tab as opposed the the currently open one?

Thanks

Mike

    This topic has been closed for replies.
    Correct answer OhAdobeYouSoCrazy

    Wether this opens in a new tab or new window will be dependent on the users browser settings, but this should do what you want it to.

    <a class="link">Link</a>
    <script  type="text/javascript">
        $
    ("a.link").on("click",function(){
            window
    .open('www.yourdomain.com','_blank');
        });
    </script>

    2 replies

    Jon Fritz
    Community Expert
    Community Expert
    October 30, 2017

    Adding a Target of _blank to a standard link will also open in a new tab/window...

    <a href="yourpage.html" target="_blank">Your Link</a>

    You can do that from DW's Properties window with the link selected, click the Target dropdown and choose _blank.

    As developers, we don't have control over the user's browser to decide if it will be a new tab or a new window though, that's up to the viewer's settings.

    OhAdobeYouSoCrazy
    OhAdobeYouSoCrazyCorrect answer
    Inspiring
    October 30, 2017

    Wether this opens in a new tab or new window will be dependent on the users browser settings, but this should do what you want it to.

    <a class="link">Link</a>
    <script  type="text/javascript">
        $
    ("a.link").on("click",function(){
            window
    .open('www.yourdomain.com','_blank');
        });
    </script>