How to make a Go-Back Input button with inline JavaScript

How to make a Go-Back Input button with inline JavaScript – Now some things to note. All browsers today have a back button so adding one to your site might be unnecessary.

However, as the designer you decide what’s necessary.

<input type="button" value="Go Back From Whence You Came!" onclick="history.back(-1)" />

We use the input type as button, label our button with “Go Back From Whence You Came!”, then using the onclick attribute we use the history.back(-1) value which tells our browsers go back 1 in history.

Definition and Usage

The back() method loads the previous URL in the history list.

This is the same as clicking the “Back button” in your browser, or history.go(-1).

Note: This method will not work if the previous page does not exist in the history list.

Tip: To load the next URL in the history list, use the history.forward() method.

Related Videos: Related Videos.

Related Posts:

Systematic approach to Problem Solving

My little pony learning game in VB.NET

Introduction to JavaScript

Introduction to JavaScript – Control Flow: True and False values

Introduction to JavaScript – Control Flow

Introduction to JavaScript – Review Types and Operators

Using the Current Year in Your Posts – WordPress

How do I install plugins in WordPress?

Learn Python Lists

Methods of teaching programming

Introduction to JavaScript – Variables: Review

Introduction to JavaScript – Variables: Undefined

Python Serialization (JSON)

Introduction to JavaScript – Control Flow: if/else Statements

Introduction to JavaScript – Built-in Methods

Learn more about JavaScript Variables

How to Update: Automatically create media_buttons for shortcode selection

Introduction to JavaScript – Create a Variable: let

CODING WITH CSS: The style attribute

Introduction to JavaScript – Variables: String Interpolation

Tips and Tricks for WRITING JAVASCRIPT code

Adding Python Comments

Introduction to JavaScript – Variables: String Interpolation II

HTML paragraph tag: p

Introduction to JavaScript – Libraries

Introduction to JavaScript – Variables: String Interpolation II

Introduction to JavaScript – Libraries

How to make a go-back button with PHP code?

Why do most sites use cookies?

Who is this Android App Development course for?


Connected through code, Choose Your Platform!

About the Author: Bernard Aybout

In the land of bytes and bits, a father of three sits, With a heart for tech and coding kits, in IT he never quits. At Magna's door, he took his stance, in Canada's wide expanse, At Karmax Heavy Stamping - Cosma's dance, he gave his career a chance. With a passion deep for teaching code, to the young minds he showed, The path where digital seeds are sowed, in critical thinking mode. But alas, not all was bright and fair, at Magna's lair, oh despair, Harassment, intimidation, a chilling air, made the workplace hard to bear. Management's maze and morale's dip, made our hero's spirit flip, In a demoralizing grip, his well-being began to slip. So he bid adieu to Magna's scene, from the division not so serene, Yet in tech, his interest keen, continues to inspire and convene.