How to redirect the user to a specific page if he click in the browser back button?

Posted 8 months ago by adamjhn

I have a page with the details of a congress. n this page there is a form where user can select the quantities of efach ticket type of the congress that he wants and then clicks "Next".

Then he goes to the registration page that as a multi step form with two steps, the first is for the user to enter some registration info (name, surname, email, etc) the second is just a confirmation step, if there are no validation errors in the first step in the second step it appears a message saying that the user was registered with success in the congress. Between the two steps the url is always te same "http://congress.test/congress/10/congress-test/registration".

When the user is in the step 2 with the success message there is a url "Go back to congress details page":

                                                <a href="{{route('', ['id' => $id, 'slug' => $slug])}}"><i class="fa fa-arrow-left"></i> Go back to congress details page</a>

And its working fine.

But do you know how to redirect the user to this congress details page if he click in the browser back button? Because when the use is in the step2 and click in the browser backbutton he goes to the step1 of the multi step form but he should go to the congress details page.

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.