How can I make an admin link open in a new tab?

How can I make an admin link open in a new tab?

jacekg
Shopify Partner
4 0 0

I have an admin link in Shopify. When the user clicks that link it will be rendered within Shopify. However, I would like to open a new tab. This is the HTML shown by Shopify:

 

<li class="Polaris-Box_375yx"><a data-polaris-unstyled="true" class="Polaris-ActionList__Item_yiyol" href="/store/MY_STORE/apps/MY_APP/action?id=5206491857139&amp;shop=MY_STORE"><div class="Polaris-HorizontalStack_dv6q6" style="--pc-horizontal-stack-block-align: center; --pc-horizontal-stack-wrap: wrap; --pc-horizontal-stack-gap-xs: var(--p-space-4);"><span role="presentation" class="Polaris-ActionList__Prefix_10fbz" style="background-image: url(&quot;BACKGROUND_IMAGE_URLg&quot;);"></span><span class="Polaris-ActionList__Text_yj3uv">MY LABEL TEXT</span></div></a></li>

 

Instead, I want a new tab to be opened, like in the following example which I saw for another Shopify app. How can I achieve that? This is the HTML shown for an admin link of the other app:

 

<li class="Polaris-Box_375yx"><a href="MYAPP_URL?shop=MY_STORE_URL" rel="noopener noreferrer" target="_blank" data-polaris-unstyled="true" class="Polaris-ActionList__Item_yiyol"><div class="Polaris-HorizontalStack_dv6q6" style="--pc-horizontal-stack-block-align: center; --pc-horizontal-stack-wrap: wrap; --pc-horizontal-stack-gap-xs: var(--p-space-4);"><span role="presentation" class="Polaris-ActionList__Prefix_10fbz" style="background-image: url(&quot;BACKGROUND_IMAGE_URL&quot;);"></span><span class="Polaris-ActionList__Text_yj3uv">MY LABEL TEXT</span></div></a></li>

 

Thanks in advance!

Replies 0 (0)