2.0.2 • Published 4 years ago

backtrack-js v2.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

Backtrack for JavaScript

npm

A simple way to allow browsing history linking.

Installation

Yarn

$ yarn add backtrack-js

NPM

$ npm install backtrack-js

Usage

  1. Assuming you have a back button with id="universal_back_button":

    <a href="" id="universal_back_button">Back</a>
  2. On each page load, require and create a new Backtrack instance with the expected backButtonId.

    var Backtrack = require("backtrack-js");
    var backtrack = new Backtrack("universal_back_button");
  3. Call configureBackButton() to configure the back button's URL (via href attribute) and to pop pages when clicked (via onClick attribute).

    backtrack.configureBackButton();
  4. 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.

    backtrack.pushPage();
  5. That's it! Your back button will now automatically be populated with the previous page's URL.

Contributing

We'd love to accept your patches and contributions to this project! Checkout contributing and code of conduct to learn more.

License

Refer to the license file.

2.0.2

4 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.2

5 years ago

1.0.1

8 years ago

1.0.0

8 years ago