Zaed
Zaed

Reputation: 3

Need the below code to open a new tab instead of opening in current tab

I need the below code to open in new tab. The link is to a website which is specified with "Occupation Link 1"

{block:ifOccupation1}
    <a {block:ifOccupationlink1}onclick="window.location.href='{text:Occupation Link 1}'" style="cursor:pointer"{/block:ifOccupationlink1}>
        {text:Occupation 1}
    </a>
    {/block:ifOccupation1}

Upvotes: 0

Views: 25

Answers (2)

Koby Douek
Koby Douek

Reputation: 16675

Add ?target=_blank to the end of the URL:

{block:ifOccupation1}
    <a {block:ifOccupationlink1}onclick="window.location.href='{text:Occupation Link 1}'" target='_blank' style="cursor:pointer"{/block:ifOccupationlink1}>
        {text:Occupation 1}
    </a>
{/block:ifOccupation1}

Upvotes: 1

chandan kumar yadav
chandan kumar yadav

Reputation: 66

to open a link in new tab all you need to do is add a target to it in your anchor tag, i.e, target="_blank". this '_blank' actually opens the required link in a new tab.

**<a {block:ifOccupationlink1}onclick="window.location.href='{text:Occupation Link 1}'" target="_blank" style="cursor:pointer"{/block:ifOccupationlink1}>
    {text:Occupation 1}
</a>**

Upvotes: 1

Related Questions