These examples take the user back one page, but this can be easily changed to make the user go back many pages.
In the same way as sending a user back a page, you can redirect them forward in their browsing history.
Again if the user has many forward pages you can redirect them to any of them.
A simple back button
Using the code above a simple back button can be created.