FROM CACHE - en_header

Looking for a button to go back to previous page

braincandydan
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)
iDoThemes
Trailblazer
203 43 77

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
Andre_Borges
Excursionist
32 0 10

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

Thanks

@iDoThemes