Javascript history
Going back
Javascript has two methods of going backwards in the user history.
history.back();
history.go(-1);
These examples take the user back one page, but this can be easily changed to make the user go back many pages.
history.go(-2);
Forward
In the same way as sending a user back a page, you can redirect them forward in their browsing history.
history.forward();
history.go(1);
Again if the user has many forward pages you can redirect them to any of them.
history.go(2);
A simple back button
Using the code above a simple back button can be created.
<input name="back" type="button"value="Back" onclick="javascript:history.go(-1)" />
<input name="forward" type="button" value="Forward" onclick="javascript:history.go(1)" />
Adobe Fireworks® Adobe Flash® and Adobe Photoshop® are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States and/or other countries.
MySQL is a registered trademark of MySQL AB in the United States, the European Union and other countries.
MySQL is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Copyright Pixelcode 2005 - 2010