Reputation: 3566
I have 3 steps form, like this:
http://example.com/first-step
http://example.com/second-step
http://example.com/summary-step
I also have profile page:
http://example.com/profile
Requirement is that user cannot get back (using browser's back
button) from summary-step
to any of previous steps, he/she should be redirected to profile
page.
This logic, for some reasons, unfortunely cannot be done on backend side, so only thing remaining is manipulating browser's history. In other words, if user reaches summary-step
, previous page in browser history should be replaced from second-step
to profile
.
Is it doable? Important fact is that this should work not only on desktop, but also most popular mobile devices (iOS >= 7, Android, WP7+). Anchor hacks or adding url's get
parameter is also impossible, as long as it hits backend.
Upvotes: 0
Views: 1385
Reputation: 2613
This is how you can add your Profile page URL to the history using Javascript!
window.history.pushState('profile', null, '/profifeURL');
Upvotes: 2