How do I make external links open in a new browser tab?

Take note that according to most usability experts, opening links in a new browser tab is considered bad practice.

We invite you to read the article Seven tricks that Web users don't know, particularly the section Second browser windows: “Avoid spawning multiple browser windows if at all possible — taking the "Back" button away from users can make their experience so painful that it usually far outweighs whatever benefit you're trying to provide. One common theory in favor of spawning the second window is that it keeps users from leaving your site, but ironically it may have just the opposite effect by preventing them from returning when they want to.”

If you would still like to open external links in a new window, follow these instructions:

  1. From your Shopify admin, click Online Store, then click Themes (or press G W T):

    Click Online Store then Themes

  2. Find the theme you want to edit, click the button, then click Edit HTML/CSS.

    Click Edit HTML CSS button

  3. Under the Layout folder, click theme.liquid to open your theme.liquid file in the online code editor.

  4. Locate the closing body tag </body>, which should be near the bottom of the file.

  5. Paste the following code above the closing body tag:

    jQuery('a[href^="http"]').not('a[href^="{{ shop.url }}"]').attr('target', '_blank');

    Add before closing body tag

  6. Save your changes.

Ready to put what you've learned into action?

Build an online store with Shopify. Try it free.

Experience the future of retail now.

Shopify Point of Sale. Try it free.