Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pure HTML Back Button

Tags:

html

I want to create a Page Back Button using HTML & CSS Without using Javascript or any other language. I want to do it in pure HTML & CSS.

I searched but didn't get any solution every time javascript is included in code but I need a pure HTML no any other language.

like image 528
Owais Qureshi Avatar asked Jul 09 '26 01:07

Owais Qureshi


2 Answers

You can do it "without using JavaScript" just in case the previous page is known in advance, i.e. you are in a "detail" page and the "back" button will bring you to the "list" or home page, e.g.:

<a href="home">Back</a>

Else, if the previous page changes dynamically you need to use JavaScript history.back method:

<a href="javascript:window.history.back();">Back</a>
like image 176
Alessio Cantarella Avatar answered Jul 17 '26 07:07

Alessio Cantarella


The following piece of code doesn't require any javascript file, but still uses javascript inside html :

<a href="javascript:history.back()">Back to previous page</a>
like image 35
Félix Avatar answered Jul 17 '26 08:07

Félix



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!