Dawn Theme- How to open External Links in new window

Solved
SamW111
New Member
2 1 2

Hey Shopify Community! 

I am looking for the code change necessary for external links to open in a new window for the Dawn Theme. Shopify currently has released documentation for their "vintage themes" not on Online Store 2.0 and it does not apply to Dawn. 

Any help is greatly appreciated. 

Thanks!

Accepted Solutions (2)

Accepted Solutions
LitExtension
Shopify Partner
1985 330 405

This is an accepted solution.

You can add target="_blank" for links, refer https://www.w3schools.com/tags/att_a_target.asp .

It will help you to customize whether or not to add an open new window for the links.

Or go to assets/global.js file and paste this at the bottom of the file:

https://i.imgur.com/dArdGFW.png const links = document.links; for (let i = 0, linksLength = links.length ; i < linksLength ; i++) { if (links[i].hostname !== window.location.hostname) { links[i].target = '_blank'; links[i].rel = 'noreferrer noopener'; } }

LitExtension - #1 Shopping Cart Migration Expert
If our answer is helpful then please accept as solution!
Are you looking for a solution to migrate to Shopify? Contact us for further assistance.
Try our FREE DEMO now!

View solution in original post

SamW111
New Member
2 1 2

This is an accepted solution.

Awesome thanks! 

I actually realized that if I followed Shopify's help doc here: https://help.shopify.com/en/manual/online-store/themes/os/customize/open-external-links-in-new-tab

And paste the code they provide in that guide into the asset > global.js file it works! 

View solution in original post

Replies 3 (3)
Elias
Shopify Staff
1417 133 211

Hey, @SamW111.

Thank you for reaching out and posting this question!

I understand you're looking to modify the Dawn theme, so that external links can open in a new window. While there isn't a documentation or tutorial for this with Online store 2.0, this may be something that our Theme Support team can help you with. If your store is subscribed to a plan, then you're eligible to use the complimentary design time included with your subscription for modifying your theme. While we’re not able to provide account-specific support via the Shopify Community at this time, we’d be happy to continue assisting you through live chat, email, or callback. Please visit the Shopify Help Center and log in to your account to create a support request.

I'd love to know if our Theme Support team can help you with this. Keep me posted!

Elias | Social Care @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

LitExtension
Shopify Partner
1985 330 405

This is an accepted solution.

You can add target="_blank" for links, refer https://www.w3schools.com/tags/att_a_target.asp .

It will help you to customize whether or not to add an open new window for the links.

Or go to assets/global.js file and paste this at the bottom of the file:

https://i.imgur.com/dArdGFW.png const links = document.links; for (let i = 0, linksLength = links.length ; i < linksLength ; i++) { if (links[i].hostname !== window.location.hostname) { links[i].target = '_blank'; links[i].rel = 'noreferrer noopener'; } }

LitExtension - #1 Shopping Cart Migration Expert
If our answer is helpful then please accept as solution!
Are you looking for a solution to migrate to Shopify? Contact us for further assistance.
Try our FREE DEMO now!

View solution in original post

SamW111
New Member
2 1 2

This is an accepted solution.

Awesome thanks! 

I actually realized that if I followed Shopify's help doc here: https://help.shopify.com/en/manual/online-store/themes/os/customize/open-external-links-in-new-tab

And paste the code they provide in that guide into the asset > global.js file it works! 

View solution in original post