Hi can anyone plz help. when i open my social media and the pages like About Us, contact, Returns pages etc on my footer, They open in the same window when clicked, i want them to open in a new window. Can anyone plz help to do that.
I want to open the Social media and Pages to open in a new window, when they r clicked in Dawn Theme
Hello @Bhanu_sree ,
I came across this guide that details how to customize your theme to allow external links to open in a new tab. The process takes a bit of knowledge with coding, so if you’re not comfortable doing so, I suggest reaching out in our Community Forums to request help from a Developer or hire a Shopify Expert to complete the task for you.
May I ask what theme you’re using? This option can sometimes be built into the theme editor, in which case it would be a simple change that I can guide you through right here. Let me know!
Hi Reb Thank u for replying…I am using a Dawn theme
Thanks, @Bhanu_sree !
For the Dawn theme, while it isn’t a build in feature, I believe I found the necessary code.
In the theme file named assets/global.js you can paste the following code at the bottom of the file:
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’; } }
Though before you do so, I highly recommend creating a duplicate of your theme and attempting the code in the new copy. This will make sure that nothing changes to your Published theme and you can test it out to be sure it works as expected. I will include the steps below:
- Open your store and click on ‘Online Store’
- Go to ‘Actions’ next to your theme and click ‘Duplicate’ from the drop down menu
- Scroll down to see the copied theme click on ‘Actions’ of the copied theme and select ‘Rename’ from the drop down menu
- Rename your copied theme
- Now, you can click on the ‘Customize’ button next to your copied theme and make the changes you want, without interrupting the live site
- When you are happy with your updates, exit the Customization and click on ‘Actions’ next to your copied theme.
- Select ‘Publish’ from the drop down menu, this will over-ride the current live theme and make your copy Live
Let me know if I can clarify any of the above!