Highlighted

Opening a link in a new tab

Community Beginner ,
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

Community Beginner
Correct answer by Leifch | Community Beginner

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>

Views

1.8K

Likes

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

Opening a link in a new tab

Community Beginner ,
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

Community Beginner
Correct answer by Leifch | Community Beginner

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>

Views

1.8K

Likes

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

Likes

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
Reply
Loading...
Oct 30, 2017 1
Adobe Community Professional ,
Oct 30, 2017

Copy link to clipboard

Copied

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.

Likes

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
Reply
Loading...
Oct 30, 2017 1