Introduction

April 5th, 2010

Ajax is a very cool solution but there is one common problem: The history back / forward buttons doesn’t work.

A few people have tried to fix this problem, some of them are doing it well, some of them aren’t. The people who are doing a great job fixing the problem often tends to write very advanced code – so I decided to learn about the problem and make a simple solution.

Bookmarks
I have named this project “Bookmarks”. Bookmarks is a lightweight javascript (only 3KB) solution for the management of browser history in ajax applications.
Bookmarks stores the actions made with ajax and enables the user to move back and forward using the browsers back and forward buttons.

The code is developed by Michael Nilsson (that’s me), an interface developer working at Bysted located in Copenhagen, Denmark. Bookmarks is written in easy to understand javascript and can be included on any site you prefer.

The Problem
The back and forward buttons work great for normal websites – as you surf your browsers location bar updates with the new url. Browsers are built for this behaviour so they are trapped when using ajax.

In applications using ajax such as Facebook, Gmail etc. you stay on the same page – the content changes as you navigate but the browsers location bar stays the same.

The Solution
Bookmarks solves this issue using hashtags as identifier. Take a look at the ajax history back fix example..

Browsers

Bookmarks is tested in the following browsers:
  • Internet Explorer 6 (WIN)
  • Internet Explorer 7 (WIN)
  • Internet Explorer 8 (WIN)
  • Google Chrome (WIN)
  • Mozilla Firefox  (WIN)
  • Opera  (WIN)
  • Apple Safari (WIN)

Leave a ReplyX




Doogl