A simple way to allow browsing history linking.
npm install backtrack-jsA simple way to allow browsing history linking.
bash
$ yarn add backtrack-js
`$3
`bash
$ npm install backtrack-js
`Usage
1. Assuming you have a back button with id="universal_back_button":
`html
Back
`1. On each page load, require and create a new Backtrack instance with the expected
backButtonId.
`javascript
var Backtrack = require("backtrack-js");
var backtrack = new Backtrack("universal_back_button");
`1. Call
configureBackButton() to configure the back button's URL (via href attribute) and to pop pages when clicked (via onClick attribute).
`javascript
backtrack.configureBackButton();
`1. Call
pushPage() to push the current page into the history stack so that when the user moves to the next page, clicking the back button, will return the user to the current page.
`javascript
backtrack.pushPage();
``1. That's it! Your back button will now automatically be populated with the previous page's URL.