Back and Forward Buttons

The back button goes back.

The forward button goes forward.

Simple with plain html. Complicated with dynamic applications. Until now.

HashRouter sites are built with this simple methodology:

  1. When users click something, only change the url.
  2. When the url changes have page elements respond.

As you build your site, intentionally keep your javascript code ignorant of what caused the url to change. It may have been a link, the back button, or a bookmark but your code shouldn't know or care. Try it by sorting the table below and then clicking your back button a few times.

Student Fruit Age
Adam Apple 17
Tim Banana 44
John Kiwi 14
Sally Avacado 32
Jeff Strawberry 28