0

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}
Zaed
  • 3
  • 1
  • 4
    Possible duplicate of [Open link in new tab or window](http://stackoverflow.com/questions/15551779/open-link-in-new-tab-or-window) – Steve Mar 12 '17 at 07:56

2 Answers2

1

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}
Koby Douek
  • 16,156
  • 19
  • 74
  • 103
1

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>**