Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I am trying to create a button that will return the user back to the previous page that they came from. I have tried:
<a href="javascript:history.go(-1)">Click here to go back to previous page</a>
but for some reason it does not work.
Anyone have any ideas on how to get something like this working?
You could try putting your JS inside the onclick="" attribute instead of the href="" one.
Probably better to use a button in this case instead of an anchor:
<button onclick="history.go(-1)">Click here to back to previous page</button>
Where should I place the coding in Shopify? Thanks so much.
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025