• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Opening a link in a new tab

Community Beginner ,
Oct 30, 2017 Oct 30, 2017

Copy link to clipboard

Copied

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

Views

3.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Oct 30, 2017 Oct 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>

Votes

Translate

Translate
Community Beginner ,
Oct 30, 2017 Oct 30, 2017

Copy link to clipboard

Copied

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>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 30, 2017 Oct 30, 2017

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines