HTML Back Button and Browser Back Button


Website viewers can use back buttons to view past pages. The browser back button is the option that provides a back route to the location of previously visited pages. Website owners can use HTML code to create a back button on their web pages. The back button eases the process of navigation across different pages and sections of a website. Similarly, coders can use JavaScript to disable the back button of the browser although it may be annoying for the end users to see the disabled browser. In this article, you will find out about the different ways to use the back button and you can even find sample HTML back button codes that can be integrated into your website.

The back button is symbolized by the icon that is depicted as an arrow pointing towards the left. It’s available on the web browser to allow the user to go back to the previously visited pages and to view the content again. In this sense, it helps the user to track the recent history of browsing. The back button is a pointer that is linked to the page previously visited by the user. When a user clicks the back button of the browser, the user will be brought to a previously visited page. Another click will show the next previously visited page and so on. All the browsers keep a record of the websites visited by the user. Since the pages visited by the user are stored locally in the machine, it takes very little for the browser to show the pages. In some websites, the page is refreshed on clicking the back button and it may take some time to show.

Back buttons help website owners to provide a better view of the facilities and services provided by the website. To understand the benefits of a browser back button on a website, let’s look at an arbitrary example. Let’s assume that you are running a website which is a shirt retail store. There are many shirts of various brands and styles displayed on different pages. To make a purchase, the user may wish to see all the various options to analyze and compare the designs. The user should be provided with a section where the shirts of the required designs are depicted on each page one by one or in groups. This way, the user can compare the designs by looking back and forth between the pages by using the back button. It helps the user to see all the options in a particular section of products conveniently. Website owners can disable the functioning of the web browser’s back button and provide their own back button to trap the viewers, effectively limiting them to the particular website. It helps the website owner to provide a better view of the website’s features and prevent users from getting out of the website. It’s functioning resembles the back button of web browser but it can only be used to view the pages within a particular website.

Linking the page to previously visited pages is very simple in HTML. To create a back button, the <input> tag of HTML can be used. The function “onClick” of JavaScript is used to track the user activity. If the user clicks the back button, the “OnClick” event is triggered, sending the user to a previously visited page which is indicated by “-1”. The sample code is given below:

<Form><input value="Back" onClick="history.go(-1);return true;"> </form>

If the browser doesn’t support JavaScript you can use the code:

<A href="test.html">back</A>

There are many benefits of using the back button but it should be used in a user friendly way. Providing a back button and disabling the back button feature of the browser helps the website owner to lock-in the viewers to the website but sometimes it can be annoying for some users who are not interested in just one website. Here are some links to more information about HTML back button.