0

I'm developing a registration form that leads users to a "Thank you" confirmation page. On this confirmation page, I'd like to have a button that redirects users to wherever they were prior to the registration page.

The only catch is that my client needs this to be done entirely on the front-end, with HTML5 and JavaScript.

Given these constraints, what's the most efficient way to generate a link that sends the user to where he/she was two pages ago?

pnuts
  • 58,317
  • 11
  • 87
  • 139
hawkharris
  • 2,570
  • 6
  • 25
  • 36

2 Answers2

1

How about setting cookie containing the value of referring URL upon entering the registration page, and then using this value to redirect upon leaving the 'Thank you' page?

1

If I understand your question correctly, you can just do this when the button click:

<script>
function goBack()
  {
  window.history.go(-2)
  }
</script>

<body>
<button onclick="goBack()">Go Back 2 Pages</button>
</body>

This was directly from example of w3school http://www.w3schools.com/jsref/met_his_go.asp

Nathan Do
  • 1,985
  • 19
  • 24