Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

eddy1992's avatar

Using back button of browser to go to previous url.

Hi I am coding and building my website using Laravel. I do not know how will I make the back button of the browser go to the previous URL.

0 likes
7 replies
eddy1992's avatar

Thank you for your reply @bestmomo but where should I add this. I mean should I create a back button in the view ?

bestmomo's avatar
Level 52

@eddy1992

There is the browser button but you said you want a button in your form so you can create it, for example with Bootstrap :

<a href="javascript:history.back()" class="btn btn-primary">Back</a>
3 likes
Rixton's avatar

Use this for laravel (bootstrap + fontawesome)

<a href="{{ URL::previous() }}" class="btn btn-warning"> <i class="fas fa-arrow-left"></i> Go Back</a>
2 likes

Please or to participate in this conversation.