https://github.com/pakej/backtrack-js
A simple way to allow browsing history linking.
https://github.com/pakej/backtrack-js
back browser button history javascript
Last synced: 2 months ago
JSON representation
A simple way to allow browsing history linking.
- Host: GitHub
- URL: https://github.com/pakej/backtrack-js
- Owner: pakej
- License: apache-2.0
- Created: 2016-10-23T18:59:15.000Z (over 9 years ago)
- Default Branch: develop
- Last Pushed: 2019-12-13T14:42:46.000Z (over 6 years ago)
- Last Synced: 2025-12-27T15:58:08.070Z (7 months ago)
- Topics: back, browser, button, history, javascript
- Language: JavaScript
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Backtrack for JavaScript

A simple way to allow browsing history linking.
## Installation
###
Yarn
```bash
$ yarn add backtrack-js
```
###
NPM
```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.
## Contributing
We'd love to accept your patches and contributions to this project! Checkout [contributing](CONTRIBUTING.md) and [code of conduct](CODE_OF_CONDUCT.md) to learn more.
## License
Refer to the license file.