FROM CACHE - en_header

Looking for a button to go back to previous page

New Member
1 0 0

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&colon;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?


Replies 2 (2)
203 43 78

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>


Developer of Liquify Chrome Extension -- Enhance the Shopify Theme Code Editor

Theme Developer -- Drop me a line
32 0 11

No one gave you the credit but it works!!!